Mobile safari popup

I am working on a web application that needs to open a new browser window for some purpose. I use the JavaScript method window.open () for this child window. This.once is created using this method. I use the window.focus () method to navigate between the parent and child windows. This works great on all browsers for desktops and Android.

code:

<a href="javascript:void(0);" onclick="openWin('url')"> 

to open the window:

 function openWin(url){ myWindow = window.open(url,"myWindow"); myWindow.opener = window; myWindow.focus(); } 

to return to the parent from the child

 window.opener.focus(); 

switch back to child

 myWindow.focus(); 

Now the problem is when I use it on a mobile safari (ipod touch), it shows a warning โ€œThis site is trying to open a pop-up windowโ€ with the options โ€œAllowโ€ and โ€œBlockโ€. when I click "Allow", it opens a new window, but navigation with window.focus does not work. I think that his browser Safari perceives it as a pop-up window, and not a full browser window, and therefore it cannot return the browser object at creation (myWindow).

in the same application, I use the same code when I click on the button, and it works on ipod very well, without such a warning, but does not work with the anchor tag.

can someone tell me what i have to do for it to work, thanks in advance. Anil.

+4
source share

All Articles