[RESOLVED BY OP]Google site search bookmarklet does not work

Ask for help about NoScript, no registration needed to post
Derleth
Posts: 3
Joined: Fri Nov 18, 2011 2:07 am

[RESOLVED BY OP]Google site search bookmarklet does not work

Post by Derleth »

I have, in my bookmarks toolbar, a little Javascript bookmarklet that should do a Google site search for whatever domain is serving the web page in the currently active tab. Instead, it doesn't work at all on real sites, even ones where I have enabled all the Javascript coming from the web page's domain, such as this one. Instead, the page just flickers, like it's trying to load the search page, but it stays right where it is. In fact, testing it now, the only pages I can confirm it to work on are about:blank and about:config.

As a further oddness, it does something to the little NoScript icon in the toolbar (yes, I have a toolbar while running Firefox 7.0.1, thank you very much): The script, in case you don't want to read the source, will first check to see if you have any selected text in the active tab; if you do not, it pops up a little window to ask you what terms to search for. While this window is up, the NoScript icon has a little red exclamation point (!) next to the blue-on-white S, as opposed to the usual 'just the blue-on-white S' or red slashed circle.

Here is the source code:

Code: Select all

javascript:q%20=%20""%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt("You%20didn't%20select%20any%20text.%20%20Enter%20a%20search%20phrase:",%20"");%20if%20(q!=null)%20location=("http://www.google.com/search?num=100&q=site:"%20+%20escape(location.hostname)%20+%20"%20\""%20+%20escape(q.replace(/\"/g,""))%20+%20"\"").replace(/%20/g,%20"+");%20void%200
I have gone to about:config and enabled noscript.allowBookmarks, noscript.allowURLBarImports, and noscript.allowURLBarJS. I'm currently right now running Firefox 7.0.1 from the Ubuntu repos, but this also happens (essentially) the same way on the current Firefox from the Beta update channel.
Last edited by Tom T. on Sat Nov 19, 2011 6:31 am, edited 1 time in total.
Reason: mark as resolved by op
Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
User avatar
therube
Ambassador
Posts: 7969
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Google site search bookmarklet does not work.

Post by therube »

WFM.
Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0

Started off by doing a Reset (only cause I had no idea in what state my settings may have been in).

From here (not allowed): http://www.gena01.com/
HIghlighted: "Win32Pad"
Bookmarklet returned (as expected): http://www.google.com/search?num=100&q= ... in32Pad%22

While this window is up, the NoScript icon has a little red exclamation point (!) next to the blue-on-white S
I believe that expected behavior.
(As in like that is how NoScript is able to run bookmarklets, temporarily Allow Global, kind of thing. Believe I've read something to that effect here before.)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 5.1; rv:9.0a2) Gecko/20111102 Firefox/9.0a2 SeaMonkey/2.6a2
User avatar
therube
Ambassador
Posts: 7969
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Google site search bookmarklet does not work.

Post by therube »

So, create a new test Profile, install NoScript & see if your bookmarklet works.

If it does, then perhaps some particular NoScript setting.
To try to find that, copy your original prefs.js into the test Profile, & test again.
If it then does not work, it would tend to point to a particular NoScript pref.

If it still works, then it may be some conflict with another extension?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 5.1; rv:9.0a2) Gecko/20111102 Firefox/9.0a2 SeaMonkey/2.6a2
Derleth
Posts: 3
Joined: Fri Nov 18, 2011 2:07 am

Re: Google site search bookmarklet does not work.

Post by Derleth »

Well, it works in a fresh profile with only NoScript installed. Does anyone have any ideas about what could be causing it?
Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: Google site search bookmarklet does not work.

Post by Tom T. »

Derleth wrote:Well, it works in a fresh profile with only NoScript installed. Does anyone have any ideas about what could be causing it?
If it works with only NoScript installed, then you have an "extension conflict" -- one or more of your other add-ons isn't playing nicely with NS.
Do the Standard Diagnostic, or just add back your add-ons one at a time, until you find the one that breaks it again. Discovering which one it is (one you can't live without, or one you don't mind uninstalling) will determine the next step.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24
Derleth
Posts: 3
Joined: Fri Nov 18, 2011 2:07 am

Re: Google site search bookmarklet does not work.

Post by Derleth »

Tom T.: I tried that for a while, but I'm lazy and changing the search URL to https://duckduckgo.com fixed the issue, so I'll have site search at my fingertips after all.

Which does suggest that it's related to whatever Google is doing that I'm blocking. Which also suggests it isn't something I'm going to fix at my end.

(In specific: Replace the google stuff with 'https://duckduckgo.com/?q=site:' and don't change anything else. Except maybe the bookmarklet name.)
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:9.0) Gecko/20100101 Firefox/9.0
Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: Google site search bookmarklet does not work.

Post by Tom T. »

Derleth wrote:Tom T.: I tried that for a while, but I'm lazy and changing the search URL to https://duckduckgo.com fixed the issue, so I'll have site search at my fingertips after all.

Which does suggest that it's related to whatever Google is doing that I'm blocking. Which also suggests it isn't something I'm going to fix at my end.

(In specific: Replace the google stuff with 'https://duckduckgo.com/?q=site:' and don't change anything else. Except maybe the bookmarklet name.)
I use https://ssl.scroogle.org myself. Hadn't heard of duckduckgo, but at a quick glance, it seems to offer the same advantages: No tracking, no profile-building, no cookies, logs shredded in two days instead of two years or never, etc.

Anyway, if you're happy, we're happy. :D Will mark this one as solved, and if anyone else has the same issue, here are two workarounds to consider.

Thanks for the report.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24
Post Reply