3

This code is working in most android/chrome mobile browsers:

document.body.addEventListener('touchend', function (e) {
    //alert(1);
    window.open("http://test.com");
}, false)

But it is not working in iOS/Safari (tested with iPhone OS 9_2, AppleWebKit 601.1.46, Safari/601.1).

Is there any workaround to show a new window/tab with this event?

"alert(1)" is working fine, so i suppose the event is firing normally.

Thank you.

Peter Hornsby
  • 4,208
  • 1
  • 25
  • 44
greyman07
  • 31
  • 3

1 Answers1

2

It seems that since iOS >= 9.0, you can no longer use window.open inside a "touchstart" event handler function. You can use the click instead.

I iOS 8.x you can still open a page with window.open in a "touchstart" event handler function

PierreB
  • 21
  • 1