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


Click here to return to the 'Change Safari's default search engine - revisited' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change Safari's default search engine - revisited
Authored by: jeremyrh on May 17, '03 11:52:10AM

That looks great, but ....
what do you do when you want to use a search engine with a LONGER string, e.g. google.co.uk instead of google.com? Any ideas?



[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: jeremyrh on May 19, '03 04:04:21AM

To answer my own question:
http://%@.google.co.uk/%@?q=%@&ie=UTF-8&z=TF-8

This works, but what is the significance of changing the last "oe=UTF-8" to "z=TF-8" ??



[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: gavinh on Jun 24, '03 06:54:19AM

My way of getting round this is to use one line of PHP code and the webserver installed as standard on OS X!
If you want to give it a try this is what you have to do (all of this is easiest done in Terminal):

1. Create a directory in your webservers root by typing:

mkdir /Library/WebServer/Documents/www

2. Create your PHP script by doing the following:

vi /Library/WebServer/Documents/www/search.php

3. While the file is open in your terminal window push the 'i' key on your keyboard (this puts you into Insert mode so that you can type into the file). Now type the following:

<?php header("Location: http://www.google.co.uk/search?hl=en&ie=ISO-8859-1&q=".$search."&btnG=Google+Search&meta=cr%3DcountryUK%7CcountryGB"); ?>

4. Be aware that the above line of code must be on a single line and not over several lines! Once you have typed this in hit the 'esc' or Escape key to come out of Insert mode. Now type:

:wq!

5. And hit the Return or Enter key. (For those that don't know ':wq!' is the command to Write the file and Quit Vi)

6. Now you need to edit the Safari executable. Type:

vi /Applications/Safari.app/Contents/MacOS/Safari

7. Once the file is open in your teminal window to search for the entry to be deleted type:

/google.com

8. You will be taken to the piece of code that contains 'http://%@.google.com/%@?q=%@&ie=UTF-8&oe=UTF-8'. You need to replace this piece of code. To do this use the 'x' key on your keyboard to delete, then hit the 'i' key again to go in to Insert mode and type:

http://localhost/%@/%@.php?search=%@&000000000

9. Hit the 'esc' or Escape key and then type:

:wq!

10. And hit the Return or Enter key.

Thats it! To explain what we've done, the Safari executable now looks at a script on your local machine which then redirects to the correct search engine. I have used '&000000000' to pad out the line as mentioned in an earlier post as the entry must be the same length as the original.

I hope this is of some use to people.



[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: aranor on Feb 20, '04 02:08:26AM

Ah, but that depends on register globals being turned on. Try using $_GET['search'] instead of $search



[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: arumdevil on Apr 11, '06 04:10:16AM
you can paste in the following to use google.co.uk as the search engine. note that this will still search the entire web rather thanm UK sites only:
http://%@@google.co.uk/search?hl=en&q=%@&meta=
a

[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: smoothy.boothy on May 08, '06 11:36:50AM

When i try that and i perform a search, no matter what i type it just searches search! Very annoying. Does anybody know how to fix it?



[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: Yennick on Nov 24, '09 06:28:33AM

add an extra %@ instead of the text "search" in the URL



[ Reply to This | # ]