Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Emulate Firefox's type-ahead search in Safari Web Browsers
As input managers are in danger in Safari 3.0 and later versions, it might be useful to know that a type-ahead search feature that emulates Firefox can be enabled in Safari using a fairly simple hack that involves native OS X tricks.

To do so, quit Safari and go to System Preferences » Keyboard & Mouse » Keyboard Shortcuts. Click the '+' to add a new shortcut, select Safari as the Application, Find... as the Menu Title, and a temporary (and arbitrary) shortcut as Keyboard Shortcut. (Note that this field does not allow a simple entry, such as '/', but instead requires a modifier key like Command or Option.)

Now go to ~/Library/Preferences and edit com.apple.Safari.plist. (You may be able to just double-click and open the plist in Property List Editor if you have Xcode installed.) Find the NSUserKeyEquivalents entry and edit the string entry for Find..., replacing the arbitrary shortcut you entered earlier with /. This will remove the need for a modifier key, and allow / to activate search.

Now relaunch Safari and type /; you should see the Find box appear, emulating the type-ahead search in Firefox.

[robg adds: Queue user fds offers up a one-line Terminal alternative to creating this shortcut: defaults write com.apple.safari NSUserKeyEquivalents -dict-add Findů /. He also points out the downside of this modification: if you're in a text box, you won't be able to activate the search box, as the text box will accept all the '/' keystrokes, as it should. With the default of Command-F, you can use find even when a text field has focus.

If you'd like to undo this modification, and you used the long method above to create it, you can just delete the entry in the Keyboard Shortcuts list. If you used the Terminal shortcut, though, there won't be an entry there. You can either add it and then delete it, or this should work in Terminal: defaults write com.apple.safari NSUserKeyEquivalents -dict-add Findů @f.]
    •    
  • Currently 1.63 / 5
  You rated: 2 / 5 (8 votes cast)
 
[13,918 views]  

Emulate Firefox's type-ahead search in Safari | 5 comments | Create New Account
Click here to return to the 'Emulate Firefox's type-ahead search in Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Emulate Firefox's type-ahead search in Safari
Authored by: swilcox on Dec 21, '07 08:46:11AM

What this does *not* you, it seems, is the ability to type Return if you find a link to navigate there. Of course, neither does the regular Cmd-F Find function; typing Return just finds the next occurrence of the string.

What I want is what Firefox does give me, the ability to navigate to the link found by the type ahead function by typing Return. I know that Saft adds this capability, but I've given up on Saft. Does anyone know of a way to add this capability?



[ Reply to This | # ]
Emulate Firefox's type-ahead search in Safari
Authored by: hankk on Dec 21, '07 10:09:30AM

Very cool -- thanks!

You can also set this up to be an equivalent to Firefox's Find Next key -- e.g.

defaults write com.apple.safari NSUserKeyEquivalents -dict-add "Find Next" N

which makes 'N' go to the next-found search match (F3 in Safari, but N is easier to hit). A small difference is that Safari's Find puts the focus in the text search box, so you need to hit Escape to get out of that before hitting N. At that point I suppose you've hit two keys and you may as well just have hit Safari's default Apple-G, so perhaps this is all moot.



[ Reply to This | # ]
Emulate Firefox's type-ahead search in Safari
Authored by: meikokun on Dec 21, '07 10:17:21AM
if you REALLY want to have type ahead features, without having to type anything before you type ahead (is it just me, or is my grasp of the English language leading me astray here...?) get the free and very excellent safari stand http://www.macupdate.com/info.php/id/16687/safaristand

it does just what you want, amongst many other things, including the ability to command click on an item which requires a plug-in, like an .flv file from youtube, and have it download to your downloads folder, without going to the activity window to find it, or indeed install another app to do the trick

cheers and merry christmas all, especially the staff at macosxhints for keeping the site up and running!

[ Reply to This | # ]
Emulate Firefox's type-ahead search in Safari
Authored by: ra5ul on Dec 21, '07 03:06:47PM

this doesn't emulate anything. it just changes the default shortcut.

the problem with saft's FAYT is that it breaks all my other single-key shortcuts. i requested he add "/" as an optional starter... no response.

regarding firefox/opera's return = activate link feature, i've resorted to the following bookmarklet and bound it to a keystroke. it only works in webkit nightlies right now:

javascript:
(function () {
function code(node) {
var link = node.getSelection().anchorNode;
if (link) {
/* simulate mouse click */
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
return link.dispatchEvent(evt);
}
/* failed. recurse frames */
for (var i = 0; i < node.length; i++)
if (code(node.frames[i]))
return;
}
/* code call */
code(window);
})();



[ Reply to This | # ]
Emulate Firefox's type-ahead search in Safari
Authored by: johnga1t on Dec 23, '07 08:39:56AM

this is also a nice mod for searching in mail.app ...



[ Reply to This | # ]