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

Create a google search sheet in browsers Web Browsers
I picked up this tip from Reinhold Penner in the Chimera mailing list. Basically you can get Chimera (and other browsers as well) to show a sheet with a text field to search in google. Very handy, and it's done by basically just adding a bit of JavaScript in the Apple InternetConfig setting file of OS X.

Just open ~/Library -> Preferences -> com.apple.internetconfig.plist in TextEdit (or Property List Editor if you have the developer tools) and look for the WebSearchPagePrefs entry. In TextEdit, this is what my entry looks like:
  <key>WebSearchPagePrefs</key>
<dict>
<key>ic-data</key>
<string>javascript:q=document.getSelection();
for(i=0;i<frames.length;i++){q=frames[i].document.getSelection();
if(q)break;}if(!q)void(q=prompt('Enter Google Search Keywords:',''));
if(q)location.href='http://www.google.com/search?client=googlet&q='+
escape(q)</string>
</dict>
In Property List Editor, just add the "javascript" bit, which should be one long line, not five as shown here for narrower display (no spaces, no carriage returns, just one long line). Save the changes and quit the editor. Now start Chimera and Select Search Page from the Go menu. Cool, eh?
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[4,812 views]  

Create a google search sheet in browsers | 14 comments | Create New Account
Click here to return to the 'Create a google search sheet in browsers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Or, copy this link
Authored by: mithras on Sep 23, '02 10:52:09AM
Google Search just do a 'copy link location' with the above link, and paste it into a new bookmark. dragging the link into the bookmark toolbar didn't seem to work...

[ Reply to This | # ]
generic use of this
Authored by: Krioni on Sep 23, '02 01:53:52PM
I took mithra's example, and made a generic version (formatted-should be a single line - no returns or spaces):

javascript:promptMsg='TYPE YOUR PROMPT MESSAGE HERE:';
actionURL='URL BEFORE SEARCH TERM';q=document.getSelection();
for(i=0;i<frames.length;i++){q=frames[i].document.getSelection();
if(q)break;}if(!q)void(q=prompt(promptMsg,''));
if(q)location.href=actionURL+escape(q)

Change the two places in that code, and then you can put in any search/terms pair.

Here's an example that searches VersionTracker for OS X software (formatted-should be a single line - no returns or spaces):

javascript:promptMsg='VersionTrackerX Search Terms:';
actionURL='http://www.versiontracker.com/mp/new_search.m?
productDB=mac&mode=Quick&OS_Filter=MacOSX&search=';q=document.getSelection();
for(i=0;i<frames.length;i++){q=frames[i].document.getSelection();
if(q)break;}if(!q)void(q=prompt(promptMsg,''));
if(q)location.href=actionURL+escape(q)

Search VersionTracker X

[ Reply to This | # ]

Type into the address field
Authored by: DavidRavenMoon on Sep 23, '02 02:17:37PM

While it's not as cool looking as this tip you can already do this in Mozilla.

I have Mozilla set up to use Google as the default search engine.

Then all you have to do is type your search text into the address bar and press the down arrow key twice and hit enter.



[ Reply to This | # ]
Even cooler, it will search on selected text
Authored by: Mitchell on Sep 23, '02 04:02:26PM

I implemented this hint using the property list editor and it worked perfectly. Later in the morning, I had some text selected in a Chimera window (a phone number I was typing into an address book), and when I hit the chord for command-shift-F to search on something else, it ran a google search on the selected text, identifying the owner of the phone number in a reverse directory database. That's without dropping the sheet, or interacting at all with the user, just select, command-shift-F, and a window full of search results.

I've been using it ever since to follow up results in news articles if I want more information. Very cool!



[ Reply to This | # ]
can't get it to work
Authored by: jmb on Sep 23, '02 04:26:32PM

I can't get this to work. I've tried pasting the above into com.apple.internetconfig.plist in place of the old entry, or by using the Property List Editor. Either way, still no go. For the latter approach, I just put in the string of text from "javascript" through "(q)" - after removing the extra spaces and returns, I pasted it over the default excite.com entry. Any guesses as to what I'm doing wrong? Thanks,

jmb



[ Reply to This | # ]
alternative approach
Authored by: jmb on Sep 23, '02 06:03:11PM

Couldn't get it to work before but, by following the release notes to get around the excite.com default, I got it working...

In short, go into the WedsiteDefaults.string file located inside the app package (drill down a couple of levels, I think it's in Contents/Resources) and change the default search page, putting in the java script string in place of the url that is currently there. Delete out the leading comment marks, and delete everything after the semicolon (leave in the quotes surrounding the url, though). Save and re-launch Chimera. Works like a charm, and the searching on highlighted text works here, too. Very cool.



[ Reply to This | # ]
Sweet! Thanks!
Authored by: avonterr on Sep 23, '02 06:40:00PM

In Chimera: Highlight text - Cmd-Shift-F runs the Google search!

Two requests for the gurus:

(1) Can we get this going in Mozilla?

(2) Can we build a Toolbar Item (or a Control-Click menu item) that will run the javascript?



[ Reply to This | # ]
Sweet! Thanks!
Authored by: mahakali on Sep 26, '02 02:09:26PM
(1) Can we get this going in Mozilla?

In Mozilla, you just need to highlight the words, control-click and choose Web Search for «whatever text you highlighted». You can specify your search engine from the preferences.

[ Reply to This | # ]
alternative approach
Authored by: jmb on Sep 23, '02 08:16:40PM

I'm not sure what you mean by building a toolbar item. In Chimera, you can customize the toolbar and add the search button to it. Using the above mods, the toolbar search button (or cmd-shift-f) will pull up the search sheet. Can you directly modify the preferred search site in the Mozilla prefs? If so, you could probably just paste the javascript into the url field. You can't access these prefs in Chimera (yet) so you have to do it the hard way.



[ Reply to This | # ]
alternative approach
Authored by: avonterr on Sep 23, '02 11:04:29PM

I'd like to be able to highlight the text, then click a tool on the toolbar.



[ Reply to This | # ]
alternative approach
Authored by: tu11ym0n on Sep 24, '02 02:47:02AM

thanks! this worked like a charm for Chimera. :) would be nice if the sheet could have a pulldown of several search engine options, no?

cheers



[ Reply to This | # ]
OmniWeb
Authored by: JohnnyMnemonic on Sep 23, '02 11:02:58PM

In OW, just type "google" followed by your search terms, and it'll search google without any added modification. (Anybody know how to flag these queries as type 'feel lucky?')



[ Reply to This | # ]
OmniWeb
Authored by: LightYear on Sep 24, '02 10:25:29AM

I'm Feeling Lucky? This works for me:

http://www.google.com/search?q=%@&btnI=I%%27m+Feeling+Lucky

Call the shortcut anything ending with an '@'. For example:
lucky@

Good luck



[ Reply to This | # ]
Dave's Quick Search Toolbar
Authored by: deeraeya on Sep 24, '02 01:09:16AM

Check out Dave's Quick Search Toolbar for an example of where we should go with this style of thing.

http://notesbydave.com/toolbar/doc.htm



[ Reply to This | # ]