Javascript window.open on IOS 2 window bug - javascript

So I'm getting a little bug using this simple window.open javascript function on iOS browsers. When I click it I get 2 windows opening. Has anyone run into this problem and does anyone have a work around?
Open page in new window
Thanks!

It's not a bug. You are opening two windows: one because you have an <a> with a target="popup", the other one because you window.open a "name". The only reason it doesn't happen in desktop is because most desktop browsers would exercise their popup-blocker.

Related

Is there any way to bring a popup front with javascript?

I am writing a web application and I open some popup windows with respect to user events.
Now I want to avoid from having too many opened popups, so I decided to bring already opened popup front instead of pop a new one.
In my researches I saw that there was a method called window.focus in old browsers like before Chrome 20 or so, but this method is no longer available because of over usage for advertisement.
Is there any solid way or even workaround to bring an already opened up popup front in javascript?
Thanks,
Ugurcan
I came up with a workaround for Chrome. In javascript, when you use window.alert method, Chrome brings according window to the front, but this is not applicible for Firefox and IE.
I will use this workaround for now. Only problem here is that, one does not simply decorate window.alert pop-up box.
We can just use css z-index to bring it at front and z-index is supported in effectively all browsers (since IE6+, Firefox 2+, Chrome 1+ etc) as per caniuse.com

window.focus() or window.blur doesn't work in modern browsers?

A project I'm working on requires that we create a pop up window and then change focus back to the parent window. Many solutions that seem to have worked in the past seem to not work at all in many new versions of Chrome, Firefox, and Safari and IOS 8 Safari. For example this W3C demo http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_blur does not work in those browsers but does work properly in IE10 and below.
It seems as though browsers might have started deprecating this feature but I've seen no documentation about it. Could anyone point me to an alternative to window.focus() and window.blur() that will work on IOS 8 Safari or at least some documentation about the methods being deprecated?
----- To elaborate a bit more for my colleague ----- Mike LP
The situation is as such:
We have a web application that requires the explicit use of a popup window. Overlays and iframes are an option due to some technical constraints.
While not desirable, it is okay that the newly created popup window receives focus upon opening, but we have a button on the popup that when clicked should return focus to the parent window, while leaving the popup open.
We've been unable to accomplish this using any of the modern browsers, though we do have a solution that works on iOS 7 Safari. Unfortunately even that appears to no longer work on iOS 8.

Javascript .open opens maximized in Chrome

When using the below to open a new window in Chrome the window always opens maximized. In Firefox it opens at the correct 200x200 size, so how can I get Chrome to behave the same and not maximize?
gamewindow = window.open("","","width=200,height=200");
I'm now finding that if I include location=0 and menubar=0 that they still show up in both Firefox and Chrome. What's the deal with this? Is there some other way to do pop out windows because it seems window.open is unreliable.
I'm testing your example on win7 and it works fine on chrome, at least for me
Have a look at this fiddle
Are you using it on a maximized (fullscreen) window on Mac?
Btw, I would not recommend using window.open since it usually gets blocked by pop-up blocker
Edit: tested on Chrome stable, build 28.0.1500.95 m

use setTimeout with showModalDialog in chrome will block the tab

I need a function about ShowModalDialog with setTimeout,so I test about popup window
and ModalDialog in Google Chrome and I get some problems.
there are two popup window showing on page load.one is opened by winodw.open(),
another is opened by window.showmodaldialog() like this:
setTimeout(function(){window.open("PopupWindow.html","_blank","")},100);
setTimeout(function(){window.showModalDialog("ModalDialog.html","","")},100)};
After two popup window were opened, I click an button on PupupWindow.html. It will call
the function as follow:
function test()
{
setTimeout(function(){alert("test");},1000);
}
It's work fine in Google Chrome 14. After I update the Google Chrome to version 19,
the PopupWindow.html will be hang when call test() until the ModalDialog.html was closed.
Please tell me why the case broken on Google Chrome 19 or any way to do showModalDialog
and window.open() on Google Chrome 19. Thanks for help.
The new version of Chrome is actually exhibiting correct behavior. The same behavior occurs for me in Safari as well as Firefox.
Modal dialogs by their very nature are supposed to prevent the user from interacting with the rest of the application until they complete the modal dialog.
Chrome has been plagued by a number of issues with not handling this correctly. See http://code.google.com/p/chromium/issues/detail?id=4202, http://code.google.com/p/chromium/issues/detail?id=16045, and http://code.google.com/p/chromium/issues/detail?id=42939 for some examples. It appears that maybe they're finally starting to clean some of these up if you're experiencing different behavior.
In general using window.showModalDialog should be avoided for a number of reasons that I detail here - http://tjvantoll.com/2012/05/02/showmodaldialog-what-it-is-and-why-you-should-never-use-it/.
If you need a modal dialog I highly recommend jQuery UI's dialog plugin.

window.opener.document.getElementById(..) does not work in IE

Im trying to open new window from parent window when user choose to print the parent window ,i re-draw the parent page in the new page by using :
document.getElementById('demo_tab_info').innerHTML=window.opener.document.getElementById('demo_tab_info').innerHTML;
and then i control the element by javascript(hide some and show some of them).
That work fine with Firefox and Chrome ,but it is not with IE,does there an explanation for this?
also
window.print();
Does not work with Chrome? Can any one help with these two problems?
As for second question.
Function:
window.print()
is supported in all major browser (source: http://www.w3schools.com/jsref/met_win_print.asp)
But it is true that it is not standardized function by W3C (https://developer.mozilla.org/en/DOM:window.print).

Categories

Resources