为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

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?

more options

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);}

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);}

被采纳的解决方案

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.)

定位到答案原位置 👍 0

所有回复 (4)

more options

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
more options

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).

more options

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.

more options

选择的解决方案

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.)