Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

_blank Must Die

Removes the target attribute of hyperlinks that open a new browser window.

Removes the target attribute of hyperlinks that open a new browser window. Since some people use invalid values such as 'blank' or '_neu' and those values (surprisingly) make the link open in a new window too, this script also fixes links with such targets.




Oct 18, 2007
tanpantsman User

This is awesome, love it, thank you so much!

-Tanpantsman

 
Jul 4, 2007
az1d User

I've been happy with this script for over a year now. Thank you.

 
Jun 15, 2007
Hibria User

Fixed the annoying blank tabs from clicking forum attachment links. Many thanks for creating this script!

 
Mar 1, 2007
Dan Bailey User

Nice script, works perfectly. Cheers.

 
Jan 14, 2007
Max Kueng Script's author

Jeremy Kitchen, you're right. Firefox offers to choose between opening a new tab or a new window but it doesn't let you ignore the target attribute. So you can't open the link in the active tab, which sometimes is what I want to do. Giving you full control over windows and tabs is actually the web developer's job (just don't use the target attribute).

 
Oct 25, 2006
Jeremy Kitchen User

Is this even necessary? Firefox already has functionality built in to ignore links attempting to open in new windows.

Forgive my ignorance :)

 
Jul 2, 2006
Johan Sundström Scriptwright

Actually, those values are not invalid; it just tells the links to open in a _specific_ window or frame; any other link set to open in the same target will update the location of that window or frame. http://userscripts.org/scripts/show/4403 drops _all_ link target attributes that do not have a corresponding frame in the present frameset.

 
Jun 27, 2006
Max Kueng Script's author

I've updated the script to version 1.3 which now also matches "_newwin" and "newwin". Thanks landstander!

 
Jun 26, 2006
landstander User

Hmmm... didn't realize that the URL would be filtered out of my post. Please email me at spikey.mcmarbles@gmail.com if any additional information is required.

 
Jun 26, 2006
landstander User

Great script, but it should also filter out the "newWin" attribute... check out <http://www.mikeacrossamerica.com/photo.html> if you need an example. After updating the regexp to "/^(_blank|blank|_new|new|newwin|_neu|neu)$/i", this page is handled as expected. Thanx!

 
Dec 20, 2005
mar 1 Scriptwright

Would it be possible to update the script to work on pages that use 'base target="_blank"' in them?

 
Dec 1, 2005
morgan 1 User

thanks wayne!

 
Dec 1, 2005
Max Kueng Script's author

I've updated the script. It does now completely remove the target attribute instead of changing the value to "_self" and I've changed the way the RegExp thing was done (thanks WayneD).

 
Nov 1, 2005
Max Kueng Script's author

Thank you, WayneD! I'll have a look at this. But, in my opinion, the parentheses are not really required as long as I'm not using subpatterns, right?

 
Oct 27, 2005
WayneD User

I neglected to mention that the script's use of "new RegExp()" is also wrong since it is trying to embed /.../i syntax inside the string. The easiest solution is to switch to the non-"new" style:

---------------------------------------------
var regTarget = /^(_blank|blank|_new|new|_neu|neu)$/i;
---------------------------------------------

The other solution is to remove the "/" and the "/i" from the string passed to "new RegExp()" and add an trailing parameter of ",'i'" to get case to be ignored.

 
Oct 27, 2005
WayneD User

The regular expression used in the code is missing some needed parentheses. It currently looks like this:

/^_blank|blank|_new|new|_neu|neu$/i

and it should look like this:

/^(_blank|blank|_new|new|_neu|neu)$/i

 
Sep 24, 2005
Jonatron Scriptwright

Also http://userscripts.org/scripts/show/1349

You could comment on this script if you were logged in.