Click to See Complete Forum and Search --> : window.open Search using QUOTES ??
ghoulardi
06-17-2004, 09:17 PM
javascript:void(window.open("http://www.google.com/search?hl=en&ie=UTF-8&q=%sl&btnG=Google+Search"));
This Opens a new window and searches Google but my problem is I cant include QUOTES when I want to include them in a search. (e.g. "1 2 3")
the %s = the searched word.
Does anyone know how I can make this work? Im a novice and Im totaly lost. I was up half the night tring to figure it out. Thanks ;)
Hello ghoulardi,
You can solve this problem by escaping your quotes.
javascript:void(window.open("http://www.google.com/search?hl=en&ie=UTF-8&q=\"Search term with quotes\"&btnG=Google+Search"));
ghoulardi
06-18-2004, 02:00 AM
Thanks alot for the help!
The problem is that If I use
javascript:void(window.open("http://www.google.com/search?hl=en&ie=UTF-8&q=\"%s\"&btnG=Google+Search"));
Then the QUOTES are always there.
It is for a toolbar I am working on.
It installs a reg file with all the search urls
The %s is what the toolbar uses for the search field.
The URLs look like this in the reg
http://www.google.com/search?hl=en&ie=UTF-8&btnG=Google+Search&q=%s
So when I enter a search in the toolbar (e.g. cow)
It will change the %s to cow Like this...
http://www.google.com/search?hl=en&ie=UTF-8&btnG=Google+Search&q=cow
but the search opens in the same window.
The one you gave me works perfect but...
javascript:void(window.open("http://www.google.com/search?hl=en&ie=UTF-8&q=\"%s\"&btnG=Google+Search"));
the quotes are permanently in the search.
Is there a way to have it so single and double quotes can be used but only when needed? Does that make any sence?? :)
Thanks again!!
Well, if you're actually programming your toolbar, I'd check for instances of quotes or apostrophes and escape them with backslashes...