Way to open popup in a new window - javascript

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.

Related

Open new tab in browser window (opened with window.open)

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

target=_blank to open a tab, and if failing opening a tab, opens popup with height and width

Currently, when you give a a tag a target="_blank" property, Chrome, Firefox, and modern IE browsers will open the link in a new tab. Safari and older IE will open it in a new tab. Using window.open is consistent in opening a popup for all browsers and lets you specify height and width, but modern browsers have popup blockers that will block it. Opening a new tab with target="blank" is fine/preferred, but for the browsers that are going to open that in a popup, I'd like to specify height and width, as the popup that older IE is opening is very small.
Is there a way (besides browser detection) to open a new tab, and failing that, open a new popup with a specified height and width? I believe that there is a way to do this in the reverse order, but I'd rather have the user not see a "popup blocked" alert, and then a new tab appear.
And, yes, I know that popups are annoying and insulting and terrible. This is something being asked of me by another.
The window.open method, will work when it is associated with a click event. Is this window.open associated with a click event?
** EDIT **
I have also found that a popup (window.open) tends to get hidden accidentally by users. If possible use a modal box method (like jQuery's lightbox, thickbox, simple modal, etc).

How to open current page in new window

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.

JavaScript close tab after window.open()

I've got a page which open a new window fullscreen but it still has the other page (the one which re-directs) behind so when you close the new window you are taken back to a blank page.
Is there a way to open a new window and then close the tab which is now inactive?
Currently I have some javascript like this
window.open("http://website.co.uk");
Thanks
You can technically use window.close() on the opening tab, but browsers usually will not allow JavaScript to close windows that it has not opened. Can you redirect to some useful page that the user can use once they have closed the window?
If you can add some JavaScript code to the page being opened, I think you can use window.opener.close() to close the original window. I tested it in IE8, the browser will ask for confirm before close the original window.

How to force a pop-up to open in a new window while (Always open pop-ups in new tab) is checked?

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.

Categories