why is window.open(url) opening new window instead of tab - javascript

I am calling window.open(url) and Normally that would just open a new tab.
However, On this particular page i am developing, it's opening a while new small window.
i've also tried window.open(url, "_blank")
Does anyone know what would force the window to open a new window instead of a new tab.
thanks.

The behavior is completely up to the browser and how it chooses to handle it. Most browsers open a new tab when _blank is used. There is nothing that can be done programmatically to control the behavior.

Related

How to open a new tab within window.open window - Javascript

I have below code for opening a new window.
window.open("https://www.w3schools.com", "_blank", "location=yes,height=570,width=520,scrollbars=yes,status=yes");
It opens new window as expected. If there is a link button within this new window, once user clicks on it, how to open it as new tab within the same new window instead of opening another new window in MS Edge.
Your help will be greatly appreciated. Thank you in advance!
I agree with serg06, when you use the provided code to open new window, you will find that it is just a popup, not a tab window. It doesn't have page navigation tool(go forward or backward), only when you convert it to a tab can you achieve your requirement. like this:
Otherwise, if you use target='_blank', you can only open a new tab in the parent page.

Why doesn't window.open(url, name) open in the SAME window with IE11?

The problem is when calling window.open(url, name) for a specific page, it is always opened in a new window, instead of the SAME one. In other words, every time this statement is executed, a new window is opened, while what I want is only ONE new window is opened and all the following calls will open the page in that new window. The name parameter in this javascript statement doesn't work for this case obviously. It only happens with IE11(Couldn't try other versions of IE).
When I tried opening window of my own pages, it worked as expected. But that specific page doesn't. That page is on the same host but out of my control. I don't know what exactly it does. The only thing I know is it relaxes document.domain. But even if I change the domain of the main page to be the same as that page's, it still doesn't work.
Does anybody know what's the root cause?
Thanks in advance!
The problem might be due to Internet Explorer settings.
Under Internet Options
Click Settings under Tabs
Under When a pop-up is encountered:, select Always open pop-ups in a
new tab
Under Open links form other programs in:, select A new tab in the
current window
to do that you want
window.location not open
open will open a new window/tab
EG
window.location = "http://www.google.com"
to navigate to google.com in the same window/tab

Opening new window exactly same as the parent window using javascript/jquery

I want to open web page in new window/tab. I want to make the new window to be exactly same as the previous one (with all the menubar, locationbar etc).
I tried
window.open ("http://www.google.com","mywindow");
In firefox it opened new tab and in IE it opened new window. This is ok.
But in chrome it opened new window without the standard buttons. I could only see the location bar; and all standard buttons were missing.
How to make it open the new window/tab which looks the same as the parent window?
Can I make it consistent to open either new window or new tab?

Opening url in new tab

I am trying to open a new tab with javascript.
How to write it so that it would work in chrome, firefox and IE7?
(the pages are on the same domain)
UPD: Let's presume that the user uses the default configuration of IE7...
You cannot control how the browser will handle opening new popups / pages. This is entirely handled by the browser. If the user has set their browser up to open new pages/popups in a new window, you cannot force your own page to open in a tab.
Plain HTML:
click here
Javascript:
window.open("newpage.html", "_blank");
But keep in mind what psynnott said.

Opening URL in New Tab doesn't work in existing, programmatically-opened New Window (Firefox)

I am building a web app, for myself, to control some servers on my home network, and discovered what I think is very odd behavior in Firefox.
If you open a pop-up, via javascript, in Firefox, is it then impossible to open a new tab, via javascript in that pop-up? If not impossible, how do you do it?
Given a clean, default Firefox 3.6.3 installation...
If I open a page in Firefox and then call
var my_window = window.open('http://www.google.com','_blank','top=10');
A brand new "pop-up" window opens.
However, if instead I call
var my_window = window.open('http://www.google.com');
A get a new tab.
HOWEVER...
If I call the first version
var my_window = window.open('http://www.google.com','_blank','top=10');
And then in the new "pop-up" that opens, I call
var my_window = window.open('http://www.google.com');
It opens a new tab in the original window, not a new tab in the pop-up.
This seems very odd, and not intuitive at all. Why would the call in the pop-up open a tab in the "parent" window?
This behavoir is a browser setting, the user desides if he opens a new window or a new tab when he opens a link. You cannot manipulate this.
Only thing you can manipulate is if you open the link in a "blank" screen, current window or certain frame
They are both children of the original document and modal windows generally do not have children. They are the rough equivalent of modal dialogs in the Windows OS. In fact, that is what IE does; it even calls it a modal dialog. I think that what is being described here is a new browser instance and not a window with tabs.

Categories

Resources