![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
FF 14.0.1: Bookmark with java-script function to build and open URL. Works unless clicked when already in a new blank tab, then does nothing. Why?
On 14.0.1 I have a bookmark which calls a java script function to prompt for input, build and call a dynamic URL. This has worked fine until last update of FF. It works fine if I right click and select Open in a New Tab, or new window. It works fine if I am in any other website and click it. It only does not work, if I open a new blank tab or window, and then click it from inside that new tab. Then it does nothing. Same happens whether the "New tab Page" is displayed or not. Same happens in safe mode.
Bookmark properties:
javascript:void(str=prompt(%22Document%20Number:%22,%22%22));if(str){location.href=%22https://somecompany.com/oip/faces/secure/km/DocumentDisplay.jspx?id=%22+escape(str).split(%22%20%22).join(%22+%22);}
Solução escolhida
Active developers are working on this, but it might take several weeks to see a change. Until then, workarounds would be needed.
(You can read and vote on the bug -- Bug 728313 – Bookmarklet fails on about:newtab -- but please avoid adding any "me too" comments since they get "spammed" to all the people following the bug.)
Ler esta resposta 👍 0Todas as respostas (4)
I searched for a recent thread on this but couldn't find it.
This may be the result of a security restriction on some "about" pages such as about:home and about:newtab.
Did you blank the new tab page using the little button or did you actually change the new tab page to about:blank? In case you need steps for testing:
(1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button promising to be careful.
(2) In the filter box, type or paste newtab and pause while the list is filtered
(3) Double-click the browser.newtab.url preference and enter the desired value:
(i) Page thumbnails (default)
browser.newtab.url = about:newtab
(ii) Blank tab
browser.newtab.url = about:blank
(iii) Built-in Firefox home page
browser.newtab.url = about:home
(iv) Any other page
browser.newtab.url = full URL to the page
Works for me on about:home and about:blank and with a middle-click on a toolbar button that I've created on the Bookmarks Toolbar with the JavaScript code.
It doesn't work if I click the bookmark with the about:newtab page open (no error in the Error Console either).
I had blanked out the newtab page using the little button.
My results were the same as cor-el's. It works when blank, home, or any other URL. Not when set to about:newtab, which is what the setting was.
So is this a bug, or should I just use the workaround of setting it to blank? I kind of like the newtab functionality. Would be a shame to have to forgo it.
Solução escolhida
Active developers are working on this, but it might take several weeks to see a change. Until then, workarounds would be needed.
(You can read and vote on the bug -- Bug 728313 – Bookmarklet fails on about:newtab -- but please avoid adding any "me too" comments since they get "spammed" to all the people following the bug.)