Some websites open links in a new tab, and I find this incredibly annoying. Is there any way to force links to open in the same tab, instead of opening a new one?
How to make links open in same tab? - Google Chrome Community
The latest Android update makes web links I click open in a new tab. I want to revert to same tab. - Google Chrome Community
Chrome Extension: How do i open urls in popup.html in the same tab - Stack Overflow
Open links in same tab in Chrome - Google Chrome Community
I believe that chrome does not allow the popups to open an external page by any way. The only solution I know is to place an iframe in your popup.html file with src attribute set to popup2.html and place all your html inside popup2.html. However, consider that all websites do not work well inside iframe.
If you are trying to open url in currently active tab then try following:
Attach following script to your popup.html file:
var hrefs = document.getElementsByTagName("a");
function openLink() {
var href = this.href;
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
var tab = tabs[0];
chrome.tabs.update(tab.id, {url: href});
});
}
for (var i=0,a; a=hrefs[i]; ++i) {
hrefs[i].addEventListener('click', openLink);
}
You need to add tabs permisson to your manifest file for this to work.
You only need to use chrome.tabs.update({active: true, url: 'yoursite.com'}); instead of chrome.windows.create({url:'yoursite.com'}); and the location will be opened in the same active tab
There is a 3 step workaround you can do this by
- You should know when the popup will be opened. Popups are blocked in chrome by default. But chrome will show a popup blocked notification in bottom right corner.
- click on notification to select always accept popup from this specific site
- Reload the main (parent) page. This will load the popup in small windows. Right click in titlebar of popup window and select "Show As Tab". Once popup is transformed in a window with tab, you can drag it back to main window.
Hope this helps.
Thanks.
There is the chrome extension One Window.
It is not perfect, as the popup will first be opened and then "transformed" into a tab, which you will see as a flicker. Otherwise it seems to work fine.
Looking for a solution to force any links to open in the same window of the chrome browser instead of opening in a new window.
Holding Ctrl+Left click doesn't work for all kinds of links.
"Open link in the same tab, pop-up as tab" extension doesn't work on some links.