0

Based on some very useful replies here (like this), I built some code to deal with popup blocking that works fine on other browsers (like Chrome), but not on Safari - loader and target page are just samples, they will be internal documents in the production version:

//redirecting user to a temporary page displaying some loader
test=window.open('https://codepen.io/jackrugile/full/ejsbf/', '_blank');
//setTimeout to simulate some API call
setTimeout(function() {
  //this part does not work on Safari to change the new page to target page
  test.location.replace('http://google.com');
}, 3000)

I am well aware that popup are evil, they are blocked for a reason and more, but consider I am developing a tool to be accessed and used exclusively inside a given corporate environment, the popup is in the requirements of the company itself and no, we are discussing about too many devices and people with too little technical prowess to think about just disabling the blockers for our own app.

Any tip to make it work on Safari, provided it is possible at all? I might consider dropping the window.open() part, but we need to have a reliable check to verify whether the document was successfully opened or not.

Ajna
  • 71
  • 1
  • 12
  • I'm on the same issue here, I tried to open a new tab or download a pdf file that I got after user clicked and server response, and I didn't find a way to do it. – Ofir Hadad Feb 01 '18 at 09:19
  • I anyway solved it calling a modal covering everything and having a `href` link to be clicked in order to proceed. The modal itself of course appears only when `window.open` fails. – Ajna Feb 02 '18 at 09:55

0 Answers0