目前,我在Firefox 3.6.3中使用以下内容作为书签。它会将我重定向到RFC,但active选项卡显示为object Window。我要怎么做才能摆脱那个神器呢?
javascript:var rfc=prompt("RFC Number");window.open("http://ietf.org/rfc/rfc" + rfc + ".txt")发布于 2010-05-05 23:22:05
您还可以使用自动调用匿名函数:
javascript:(function(){var rfc=prompt("RFC Number");window.open("http://ietf.org/rfc/rfc" + rfc + ".txt");})();由于它没有返回值,默认情况下将返回undefined,从而阻止导航。
它可以工作,并且您的bookmarklet不会在页面上引入任何全局变量。
发布于 2010-05-05 23:13:42
使用void operator丢弃返回值。
javascript:void(window.open("http://ietf.org/rfc/rfc"+prompt("RFC Number")+".txt"));https://stackoverflow.com/questions/2774453
复制相似问题