Is their a way to keep all pages on the internet in a single window through Chromes browser settings? or a addon/plugin that I can do this with?
I don't want web pages to open up in new tabs and/or new windows when I click on some links.
Let me know if anyone has any suggestions!, Thanks!!
<a href="http://www.bing.com" target="_blank">Opens a New Tab!</a>
<i>Thtats not what i want..., I want this link to stay in same url bar.</i>
<p>Like this!</p>
<a class="click" href="http://www.bing.com">Click Here</a>
Possible approach:
One approach could be building an extension that injects a content script in every page. This content script would parse the DOM and
remove alland set alltarget
attributes off the anchor elementstarget
attributes of anchor elements to_self
.Caveats:
window.open()
).Solution:
You could use a MutationObserver that watches for anchor elements being inserted or having their
target
attribute modified and make the appropriate adjustments.You still need to take care of tabs opened by other means (e.g.
window.open()
) if it is extremely important to you (but those cases should be very very few, so it might not be worth the trouble).Sample code:
manifest.json:
content.js: