Is there any way to override HTML's target="_blank" behavior as an end user?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops
--
Chapters
00:00 Is There Any Way To Override Html'S Target=&Quot;_blank&Quot; Behavior As An End User?
00:28 Accepted Answer Score 1
00:40 Answer 2 Score 10
01:43 Answer 3 Score 1
02:00 Answer 4 Score 1
02:28 Thank you
--
Full question
https://superuser.com/questions/456929/i...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#html #browser
#avk47
ANSWER 1
Score 10
Firefox does allow you to override it:
Users who want to change this behavior need to type in about:config in a tab in the Firefox web browser. This should open the Firefox configuration. First time users need to accept a disclaimer. They then need to filter for the term browser.link.open_newwindow. The default value of that entry is 3 which opens links that would normally open in a new window in a new tab.
To force Firefox to open links (no matter if they have been designed to open in a new tab or window) in the same tab one would need to change the value to [1] which will open all links that would normally open in a new window in the same tab. Changing the value to [2] would open new windows in a new window (duh).
Value of 1: Opens links that would normally open in a new tab or new window in the current tab or window
Value of 2: Open links that would normally open in a new window, in a new window
Value of 3: Open links that would normally open in a new window in a new tab in the current window (default)
ACCEPTED ANSWER
Score 1
If the page has jquery you can inject the following:
$('a[target="_blank"]').removeAttr('target');
ANSWER 3
Score 1
You can do this if your browser supports user scripts (such as Chrome or Firefox via a plugin).
Then you can write a user script to override the behaviour for the site/page you are interested in.
ANSWER 4
Score 1
Greasemonkey has a number of user-generated scripts that will do this.
A few seconds of google turned up "Remove Link Target" -- there are lots of others.
Update
I updated the link to the Userscripts.org mirror, since the original site is dead.
Here is the source of the script:
// ==UserScript== // @name Remove Link Target // @creator kousi // @description Removes target attribute completely. // @version 1.0 // @include http://* // ==/UserScript== var links = document.getElementsByTagName('a'); for (var i=links.length-1; i>=0; i--) { links[i].removeAttribute("target"); }