6

With Safari, if I set it to open new tabs as blank, when I hit cmd-T, my cursor is in the address bar, ready to type a URL or search.

If I set it to go to a homepage, the cursor does not immediately go to the address bar and I have to hit a keystroke.

Is there a Javascript I can put on my homepage (I'm the only one who uses it - usual "bookmark" page) so that when I visit that page, my focus (cursor) automatically goes to the browser's address bar?

I could add a search box but sometimes I want to type a URL directly.

raindog308
  • 772
  • 1
  • 10
  • 20
  • 2
    You could just implement a search box which also recognizes URLs and navigates straight to them. – Dark Falcon Jan 16 '16 at 17:26
  • I've noticed [Taco](http://tacoapp.com) has an extension that emulates their site, but still has the focus on the address bar. It might be possible to package your homepage into a simple extension instead of setting your homepage to a specific location. If you aren't having your homepage set to a location, please update in comments/question. – Ryan Leonard Jan 18 '16 at 21:07

1 Answers1

1

I don't think you can do that, but as you've said it's a "link page", you can put an input on the page that you type the address into, then use a button (or keypress) to do location = yourInput.value; which will take you to the URL you typed in. That won't have omnibox functionality (not unless you get fancy with your JavaScript and integrate it with a Google custom search engine, etc.), but for the "just type in a URL" use case, it'll work.

Alternately, the Google Custom Search Engine (if you like searching with Google) is pretty easy to drop on a page, and you can get an event when the user confirms, which you could use to check if the search input has a URL as opposed to a search in. Kind of roll-your-own omnibox. (Not touting for Google, but doing a CSE is quite easy: Create it with your Google account, drop some script on your page, add a bit of markup, and that's pretty much it. Don't know if Duck Duck Go and such offer the same sort of thing.)

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • Hi I don't quite get your last para. Why do you need Google account for? – Pacerier Oct 12 '17 at 15:16
  • @Pacerier: I don't think you can use the Google Custom Search Engine on a page without one; you need one to set it up. (Obviously the *user* of the page can *use* it without one.) – T.J. Crowder Oct 12 '17 at 15:22