Page 1 of 1
[Unrelated]Bookmarklets Fail Unless "origin" Domain Allowed?
Posted: Wed Nov 30, 2016 7:07 am
by therube
Bookmarklets Not Working Unless "origin" Domain Is Allowed?
Visit,
https://www.squarefree.com/bookmarklets ... arch_links
Add a bookmarklet, say,
https://www.squarefree.com/bookmarklets ... arch_links
Click the bookmarklet
Result: nothing
Allow squarefree.com
Click the bookmarklet
Result: bookmarklet works as expected
(And with that, I've got to dig out my Everything bookmarklet ...)
SeaMonkey 2.46
NoScript 2.9.5.2rc5
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 7:26 am
by therube
Guess I should see if its actually a NoScript issue ...
Yep, looks like it.
Though not all bookmarklets will be affected.
This works:
Code: Select all
javascript:Qr=document.getSelection();if(!Qr){void(Qr=prompt('Registry%20entry%20to%20find:',''))}if(Qr)location.href='es:'+(Qr);void(0)
-------
Also seems you cannot drag a bookmarklet from a different browser instance (as the case happens to be) into the current & drop it onto the bookmarklet toolbar.
The "indicator" shows as if it should drop, but it does not.
Code: Select all
Error: NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsINavBookmarksService.getFolderIdForItem]
Source File: resource://gre/modules/PlacesUtils.jsm
Line: 3094
(That deals with the dropping of the bookmarklet, I didn't notice anything with the "origin" issue.)
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 4:01 pm
by barbaz
It works as expected for me.
If you click the bookmarklet link with JS disabled, of course it won't work as it's then just JS in the page.
But if you bookmark the bookmarklet, then click the bookmark, it should work, and does work for me.
NoScript 2.9.5.2rc5
SeaMonkey 2.46pre (like Firefox 49.0.2)
Am I missing something here?
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:02 pm
by therube
If you click the bookmarklet link with JS disabled, of course it won't work as it's then just JS in the page.
I don't recall that having been the case?
Though now with SeaMonkey 2.40 & NoScript 2.9.0.14rc1, that particular bookmarklet, search links, still does not work - unless you allow the domain.
If the bookmarklet accessed some external site, then sure, you'd have to Allow...
Maybe I just haven't used a particular bookmarklet like this in some time so hadn't noticed?
Other bookmarklets do work - without Allowing...
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:17 pm
by therube
SeaMonkey 2.40, NoScript 2.0.14, most all my bookmarklets work, or at least the ones I can determine to have an effect:
reg, zap colors, zap cheap effects, zap, remove redirects, view selection, named anchors, up, increment, decrement, view cookies, Everything Search, fit-to-width, cookie manager, zap cookies, zoom images in, spit vertical, show links...
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:20 pm
by barbaz
You're getting confused with NoScript's fixing JavaScript links feature. Let's demonstrate exactly what's happening here.
From
https://www.squarefree.com/bookmarklets/misc.html#up -
Code: Select all
javascript:if%20(location.pathname%20==%20"/");%20else%20if%20(location.pathname.charAt(location.pathname.length-1)%20==%20"/")%20location%20=%20"..";%20else%20location%20=%20".";%20void%200
Go to
https://www.squarefree.com/bookmarklets/misc.html#up.
With JS disabled, click the "Up" bookmarklet link. Notice where you end up.
Now go back to that page using the browser Back button. Notice where the "Up" bookmarklet link you clicked is now pointing to?
Reload the page manually. Enable JS and click the "Up" bookmarklet link. Better, isn't it?
Now bookmark the javascript: URI (check to be sure it really is that javascript: URI though!) and repeat the above using that bookmark.
See the difference?
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:29 pm
by therube
You've got to talk slower when I'm around

.
SeaMonkey 2.46, NoScript 2.9.5.2rc5
The same sets of bookmarklets that work in SeaMonkey 2.40/NoScript 2.0.14 still work in SeaMonkey 2.46...
'Attempt to fix JavaScript links' does not look to have any bearing with these that do work, as in the work whether that setting is enabled or not (& whether any domain is allowed or not).
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:36 pm
by therube
> Go to
https://www.squarefree.com/bookmarklets/misc.html#up.
> With JS disabled, click the "Up" bookmarklet link.
> Notice where you end up.
https://www.squarefree.com/bookmarklets/, as expected.
> Now go back to that page using the browser Back button.
OK.
> Notice where the "Up" bookmarklet link you clicked is now pointing to?
I'm not following that?
(Unless you're meaning that I'm back to,
https://www.squarefree.com/bookmarklets/misc.html#up, again as expected.)
> Reload the page manually.
> Enable JS [for squarefree.com]
OK
> and click the "Up" bookmarklet link.
Again I'm at
https://www.squarefree.com/bookmarklets/.
> Better, isn't it?
I'm not seeing any difference in behavior.
Now bookmark the javascript: URI (check to be sure it really is that javascript: URI though!) and repeat the above using that bookmark.
See the difference?
I might be missing something, but no, whether an up "bookmarklet" as a bookmark entry or whether a "link" on the Bookmarks Toolbar, I'm not seeing any difference.
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:42 pm
by therube
So lets look at 'search links'.
Code: Select all
javascript:(function(){var%20x,n,nD,z,i;%20function%20htmlEscape(s){s=s.replace(/&/g,'&');s=s.replace(/>/g,'>');s=s.replace(/</g,'<');return%20s;}%20function%20attrQuoteEscape(s){s=s.replace(/&/g,'&');%20s=s.replace(/"/g,%20'"');return%20s;}%20x=prompt("show%20links%20with%20this%20word/phrase%20in%20link%20text%20or%20target%20url%20(leave%20blank%20to%20list%20all%20links):",%20"");%20n=0;%20if(x!=null)%20{%20x=x.toLowerCase();%20nD%20=%20window.open().document;%20nD.writeln('<html><head><title>Links%20containing%20"'+htmlEscape(x)+'"</title><base%20target="_blank"></head><body>');%20nD.writeln('Links%20on%20<a%20href="'+attrQuoteEscape(location.href)+'">'+htmlEscape(location.href)+'</a><br>%20with%20link%20text%20or%20target%20url%20containing%20"'%20+%20htmlEscape(x)%20+%20'"<br><hr>');%20z%20=%20document.links;%20for%20(i%20=%200;%20i%20<%20z.length;%20++i)%20{%20if%20((z[i].innerHTML%20&&%20z[i].innerHTML.toLowerCase().indexOf(x)%20!=%20-1)%20||%20z[i].href.toLowerCase().indexOf(x)%20!=%20-1%20)%20{%20nD.writeln(++n%20+%20'.%20<a%20href="'%20+%20attrQuoteEscape(z[i].href)%20+%20'">'%20+%20(z[i].innerHTML%20||%20htmlEscape(z[i].href))%20+%20'</a><br>');%20}%20}%20nD.writeln('<hr></body></html>');%20nD.close();%20}%20})();
I guess its something in there that is requiring the "origin" domain to be allowed, where with all of my "regular" bookmarklets that hasn't been the case?
So maybe just something I hadn't noticed before?
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:46 pm
by barbaz
therube wrote:> Go to https://www.squarefree.com/bookmarklets/misc.html#up.
> With JS disabled, click the "Up" bookmarklet link.
> Notice where you end up.
https://www.squarefree.com/bookmarklets/, as expected.
Not expected. I end up at https://www.squarefree.com/
therube wrote:> Notice where the "Up" bookmarklet link you clicked is now pointing to?
I'm not following that?
It now points to https://www.squarefree.com/ for me.
therube wrote:> and click the "Up" bookmarklet link.
Again I'm at https://www.squarefree.com/bookmarklets/.
Which matches what I get.
therube wrote:I might be missing something, but no, whether an up "bookmarklet" as a bookmark entry or whether a "link" on the Bookmarks Toolbar, I'm not seeing any difference.
Your results are exactly what I get when using the "Up" bookmarklet as a
bookmark entry. Indeed it would be the same regardless where you choose to file it.
If you're only clicking "search links" as a bookmark entry, I'd say it's time for a clean
profile with only NoScript installed, etc, etc.
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 5:49 pm
by therube
Notice where the "Up" bookmarklet link you clicked is now pointing to?
I think I'm seeing now.
Anyhow,
from
https://www.squarefree.com/bookmarklets/misc.html#up
I expect up - when run "locally", so from Bookmarks Toolbar, to
move me up to,
https://www.squarefree.com/bookmarklets/misc.html
What I see when I run up - remotely, so from the
https://www.squarefree.com/bookmarklets/misc.html#up webpage itself - without JavaScript enabled
is that I'm taken to the "top", ending up at
https://www.squarefree.com/
& that is not expected
If I Allow squarefree.com, then when run "remotely"
up takes me to
https://www.squarefree.com/bookmarklets
So what happens when running from the external webpage vs what happens when run "locally" can give a different behavior.
[Invalid] Bookmarklets Not Working Unless "origin" Is Allow
Posted: Wed Nov 30, 2016 5:50 pm
by therube
If you're only clicking "search links" as a bookmark entry, I'd say it's time for a clean profile with only NoScript installed, etc, etc.
Except for my original post, been there, doing that.
(Well, at present, I'm using my Informaction Profile, which till now had no extensions. And I copied over my "regular" Profile places.sqlite to get my "regular" set of bookmarklets to mess with.)
> With JS disabled, click the "Up" bookmarklet link.
Oh, you mean from the web page itself, what I've called, "remotely".
In my mind, & until now, I took that to mean, JS disabled, & click the "Up" bookmarklet link [on my Bookmarks Toolbar, in my browser itself].
OK, so that makes more sense now.
Went back to SeaMonkey 2.32.1, 02/05/2015, & [once I removed places.sqlite], the 'search links' bookmarklet still does not work - unless I Allow the "origin" site.
So this must just have been a behavior I hadn't caught before.
Now, I'll let you tell me why some work & some do not - without allowing JavaScript.
Re: Bookmarklets Not Working Unless "origin" Domain Is Allow
Posted: Wed Nov 30, 2016 8:41 pm
by barbaz
therube wrote:Now, I'll let you tell me why some work & some do not - without allowing JavaScript.
The "some do not" is specific to your setup. I cannot reproduce it in my main profile nor a clean profile.
So, since I don't have your setup, I've no idea why and as such can't tell you why.
I could suggest troubleshooting steps, but you know that lot at least as well as I do.
Re: [Unrelated]Bookmarklets Fail Unless "origin" Domain Allo
Posted: Sat Dec 03, 2016 2:56 pm
by barbaz
Marking this thread Unrelated per discussion with therube on IRC.
isnw, you appear to be experiencing a different issue from therube. I'll split your posts off to a new thread so that you can get proper attention.
viewtopic.php?f=7&t=22375