What i want to do is when the user opens their browser and types http://xyz.com/index.html, then it should pop up a new full screen window and then display index page in that new window.
I tried with using window.open('login.html', 'new_windwo', '_self'); and it opens a new window, but then there are 2 windows — one where user typed the URL, and the 2nd that we have open in the onLoad of the first page.
I am not able to close the first window — self.close() and window.close aren’t working. I am using Firefox 3.6.
Is there is any way that I can open current page in new window, without creating duplicate?
Thanks.
No. You can't destroy a window that you didn't create with a script in the first place.
Related
One function in my website requires that the website be opened in a new window rather than a new tab.
Is there any way to determine if the page is opened in a new window or a new tab and show an informative message to user?
-----Edited and added below to distinguish from an already asked and answered question.-------------
I do not want to open my page in a new window if it has already been opened in a new window.
I want to determine if the page is opened in a new window and if not, to provide an informative message to the user and give the option to open my website in a new window, if the user so chooses.
One of the functions on my website involves resizing the window to half its original size. Resizing is not possible inside a tab and hence this question.
The workflow is:
1) Open my website.
2) Determine if it is in a new window.
3) If yes, then continue.
4) If no, then advise visitor about the need to open in a new window and provide button, "Open in a new window?".
5) If clicked, Open the website in a new window (with a unique window name) and change focus to the new window.
6) If not clicked - continue as a tab.
Some functions which require resizing, will not work properly as a tab, though.
--------End of edit------------
You can check the history.lenght to know that if a new page/tab is opened or not. but totally knowing the difference between window is tab is a bit complex. you may check the menubar.visible too, to get hint for your problem.
Overally please check the following link for further comments and ideas:
How do identify whether the window opened is a pop up or a tab
I have a new window opened via window.open method and in that window in content I have a link with "target=_blank".
When clicked the link opens new tab in parent window instead of the one that content was in. I also noticed that for that window (created with window.open) the Ctrl+T shortcut (to open blank tab, Firefox) does not work.
I checked window.open specs and I didn't find any option that would allow this behavior.
var a = window.open("http://www.google.pl",
"Test",
"width=640,height=480,scrollbars=yes,toolbar=yes,menubar=no,location=no,resizable=yes");
a.focus();
Setting toolbar=yes makes it work in Firefox. Any idea how to make it work in chrome?
Could you show some code?
else; try with javascript:
function OpenNew(){
window.open("http://www.google.se", "_blank");
}
Rgds
After making a rest request to a webservice, I want to redirect my user to the url returned by the web service.
I am using window.open(url, "_blank"); which has, when I've used it in the past, simply opened up a new tab. However, for some reason that I can't get to the bottom of, my redirect is being treated as a popup. Instead of opening a new tab, Chrome actually creates a separate small window.
I'd be grateful for any suggestions as to why chrome would decide to create a separate window as opposed to just opening a new tab.
Thank you
Check out this response from another question. When a javascript event is initiated by the user, open() opens the link in a new tab. Otherwise, it's opened in a popup window. So if the user clicks something that triggers open(), a new tab will open. If you set a timeout or try to open a link after some other event, like an ajax response, a new window will open.
Is there any way to force IE8 to open new window only in a pop-up? I don't want to change the browser settings. I want to open it and throw Javascript window.open(). Firefox is opening it in a new window but IE8 is opening the same in a new tab. Please suggest.
hold a SHIFT button while you click on an Internet hyperlink on your browser screen. This will force the link to open in a new window
You cannot control whether a browser opens a window in a new tab or new window.
Although, one work around is to set height and width dimension in the call to window.open() alongwith disabling the addressbar and statusbar.
window.open ("http://www.example.com", "mywindow","status=0,toolbar=0,height=600,width=900");
It worked for my case, I'm not sure if this satisfies your question.
Currently, under IE8 and in IE7, using javascript window.open and target param is set to _blank, and while (Always open pop-ups in new tab) is checked, the pop up will open in new tab.
Is there a way to force the new pop up to open in a new window from javascript?
Is there a solution other than javascript?
Thanks
Nope. It's a user setting that you can't override from script on the page. This is by design.
You could try using an HTML dialog instead if you truly need a dialog type experience.