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("" + rfc + ".txt")
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/rfc/rfc" + rfc + ".txt")
Share
Improve this question
asked May 5, 2010 at 15:11
ElectricWeaselElectricWeasel
1077 bronze badges
2 Answers
Reset to default 10Use the void
operator to discard the return value.
javascript:void(window.open("http://ietf/rfc/rfc"+prompt("RFC Number")+".txt"));
You can use also an auto-invoking anonymous function:
javascript:(function(){var rfc=prompt("RFC Number");window.open("http://ietf/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.