Search code examples
javascriptipadsafari

javascript window.open in safari


I've run into an issue with opening a new window in safari (both ipad and desktop versions) that revolves around the popup blocker. Basically I've found that if window.open isn't called from a click event, safari will block the popup.

The event that is calling window.open is currently onchanged from a list box.

Is there any way other than switching which event we handle to trick safari into allowing a popup in this scenario? (the onchanged event)


Solution

  • I don't think there is a way to open a new window in mobile safari other than from a button click. Refer to this StackOverflow Question which is similar. I'm not sure if it will work, but you can look at triggering a button click programatically using jquery's trigger() function.

    You might also want to look at options of showing a dialog within your own page, maybe using tools like jquery ui.

    HTH!