views:

56

answers:

2

Currently I'm using the following as a bookmark in Firefox 3.6.3. It redirects me to the RFC just fine, but the active tab says [object Window]. What do I need to do to get rid of that artifact?

javascript:var rfc=prompt("RFC Number");window.open("http://ietf.org/rfc/rfc" + rfc + ".txt")
+4  A: 

Use the void operator to discard the return value.

javascript:void(window.open("http://ietf.org/rfc/rfc"+prompt("RFC Number")+".txt"));
KennyTM
A: 

You can use also an auto-invoking anonymous function:

javascript:(function(){var rfc=prompt("RFC Number");window.open("http://ietf.org/rfc/rfc" + rfc + ".txt");})();

Since it doesn't have a return value, by default will return undefined, preventing the navigation.

It will work and your bookmarklet won't introduce any global variables on the page.

CMS