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.
|
|
This is awesome, love it, thank you so much! -Tanpantsman |
|
|
I've been happy with this script for over a year now. Thank you. |
|
|
Fixed the annoying blank tabs from clicking forum attachment links. Many thanks for creating this script! |
|
|
Nice script, works perfectly. Cheers. |
|
|
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). |
|
|
Is this even necessary? Firefox already has functionality built in to ignore links attempting to open in new windows. Forgive my ignorance :) |
|
|
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. |
|
|
I've updated the script to version 1.3 which now also matches "_newwin" and "newwin". Thanks landstander! |
|
|
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. |
|
|
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! |
|
|
Would it be possible to update the script to work on pages that use 'base target="_blank"' in them? |
|
|
thanks wayne! |
|
|
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). |
|
|
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? |
|
|
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: ---------------------------------------------
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. |
|
|
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 |
|
|
|
You could comment on this script if you were logged in.
