How to close rogue JavaScript popup window on iPad Safari
The other day my daughter’s Safari browser on her iPad was stuck because she couldn’t close one of the tabs. It was some bogus web site with a popup message that said she had contracted a virus and to call a certain phone number so they can help troubleshoot.

At first I thought she had gotten some malware or even actually contracted a virus, because we couldn’t close the popup window or the page (tab) in Safari, and we also couldn’t browse to any of the other open tabs. We even tried closing Safari and reopening, and powering down the iPad and back on – still the same issue. It virtually made Safari useless.

I scoured the internet for a solution, but I was looking at it from the wrong angle. I was searching for the name of the company on the web page in question, and even searched on the phone number listed to see if I could find anything about this unscrupulous company. After some time I finally came across this gem that helped me solve the problem. Here’s the partial explanation:

Mobile Safari will disable the browser controls (new tab, back, etc.) when a JavaScript popup is opened. Unfortunately, this locks the browser until you press “OK” or “Cancel” (if available).

Makes sense, and as I looked at it more closely, I realized the popup only had an OK button but no Cancel button. They obviously programmed the OK button to reload the popup when clicked.

To fix the issue, you need to disable JavaScript temporarily while you go and close the page. You can then re-enable it if you wish.

Here are the steps on iPad to disable JavaScript. I imagine this would also work for the iPhone. Note: You need to first close Safari.

Open the Settings app and click on Safari, then Advanced.

How to close rogue JavaScript popup window on iPad Safari

Uncheck the option next to JavaScript

How to close rogue JavaScript popup window on iPad Safari

Now you can open Safari and close the popup and the tab. Since JavaScript is turned off the script won’t execute to keep opening the popup window.

(Visited 806 time, 2 visit today)