Bookmarklets don't work
Categories
(Firefox for iOS :: Home screen, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| fxios | 16.0 | --- |
People
(Reporter: n, Assigned: justindarc)
References
Details
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
Comment 4•7 years ago
|
||
| Assignee | ||
Updated•6 years ago
|
| Comment hidden (advocacy) |
Updated•6 years ago
|
Comment 7•6 years ago
|
||
No-one’s working on this but it’s a valid bug that actively impedes my use of Fxvon iOS every day. Can someone reopen it?
| Assignee | ||
Comment 8•6 years ago
|
||
Re-opening for consideration.
Comment 9•6 years ago
|
||
(In reply to Robin Whittleton from comment #7)
No-one’s working on this but it’s a valid bug that actively impedes my use of Fxvon iOS every day. Can someone reopen it?
I can second that. It’s a daily problem for me.
Comment 10•6 years ago
|
||
+1 on this too. It's the only thing keeping me from switching over to Firefox.
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Comment 11•6 years ago
|
||
Landed on master:
https://github.com/mozilla-mobile/firefox-ios/commit/9cc052f5df1099e54a56799ee43d429d9c13e0ce
| Assignee | ||
Updated•6 years ago
|
Comment 12•6 years ago
|
||
This appears to have regressed. Bookmarklets in F-for-iOS 19 are opening as search again.
| Assignee | ||
Updated•6 years ago
|
Comment 13•6 years ago
|
||
I put up a PR to fix the only problem I found which was that quotes were being replaced with fancy quotes: https://github.com/mozilla-mobile/firefox-ios/pull/5486
You can verify javascript: is currently working otherwise by doing javascript:alert()
Comment 14•6 years ago
•
|
||
Right, I figured out what is wrong with the bookmark, and it's down to URL quoting, see below.
You can verify javascript: is currently working otherwise by doing javascript:alert()
The bookmark editor in FF iOS does not actually let you create such a bookmark, so testing was hampered (create a new bookmark, and you'll be given a URL-specific keyboard and URLs that start with javascript: are not accepted as the Save action remains disabled). I had previously used an existing JS bookmark that indeed uses quotes but was created on the desktop. A plain javascript:alert() bookmark created on the desktop then synched to iOS indeed works.
The following bookmark is opened as a search, however:
javascript:(function(){var a=Array.from(document.querySelectorAll("a[href$='.jpg']"), l => l.getAttribute('href'));a.sort();for(var i=0;i<a.length;i++){window.open(a[i]);}})()
This bookmark is designed to find all JPEG links and opens these in separate tabs (warning: popup blockers won't like this one, especially when there are many such images). The bookmark works fine on the desktop, is synched to iOS, then fails to work as expected on iOS FF.
I traced this to URL quoting; the above uses spaces and plenty of non-URL-safe characters. Here is the quoted version:
javascript:%28function%28%29%7Bvar%20a%3DArray.from%28document.querySelectorAll%28%22a%5Bhref%24%3D%27.jpg%27%5D%22%29%2C%20l%20%3D%3E%20l.getAttribute%28%27href%27%29%29%3Ba.sort%28%29%3Bfor%28var%20i%3D0%3Bi%3Ca.length%3Bi%2B%2B%29%7Bwindow.open%28a%5Bi%5D%29%3B%7D%7D%29%28%29
That one does work properly.
I appreciate the difference, I forgot entirely that as a URL you need to quote the non-URL-safe characters. Clearly, desktop FF doesn't care and handles quoting for us. The unexpected behaviour on iOS in this case is more that it is treated as a search, instead.
Should this be treated as a bug, and if so, should this be a separate, new ticket? Should the desktop behaviour be how iOS FF handles such bookmarks?
Comment 15•6 years ago
|
||
this pains me every day... however i seem to be getting different results, namely absolutely nothing happens when i click on bookmarklets. no search, nothing. not even javascript:alert() seems to work in for me. everything works fine in safari.
iPhone 6S
iOS: 13.3
Firefox 21.0 (16918)
this bug is making me consider switching back to chrome :o(
Comment 16•5 years ago
|
||
(In reply to Martijn Pieters from comment #14)
Should this be treated as a bug, and if so, should this be a separate, new ticket? Should the desktop behaviour be how iOS FF handles such bookmarks?
this should definitely be treated as a bug. bookmarklets work in all other iOS browsers i have tried (chrome and safari) as well as all desktop browsers. to me, and i bet many others, it is a very important feature.
Comment 17•5 years ago
|
||
This issue is being tracked here: https://github.com/mozilla-mobile/firefox-ios/issues/5626. Thank you for your feedback.
Description
•