How to Enable JavaScript in Safari on iPhone

JavaScript in Safari on iPhone is switched on or off from Safari’s Advanced settings in the Settings app, not from inside Safari. Open Settings, tap Apps, tap Safari, tap Advanced, and turn on JavaScript, then reload the page that complained.

Apple lists this switch among its fixes for websites that won’t load in Safari, so it is the first thing to check when a page says it needs JavaScript. If it was already on, the second section covers Apple’s other checks.

Turn the switch on in Settings, not in Safari

  1. Open the Settings app.
  2. Tap Apps, then tap Safari.
  3. Tap Advanced.
  4. Turn on JavaScript.
iPhone Safari Advanced settings with the JavaScript switch highlighted
(1) Turn on JavaScript in Safari’s Advanced settings. (Illustration)

The illustration may show an older version of iOS; current screens may look different. Go back to Safari and reload the page so it loads again with JavaScript allowed.

These steps are the ones Apple gives in If Safari isn’t loading websites, under “Turn on JavaScript if it’s not already on.” Apple doesn’t say the switch is on out of the box, only to turn it on if it isn’t, so a phone that came from a school, an employer or a previous owner is worth checking.

If your Settings app has no Apps item, which is the case on older versions of iOS, look for Safari directly in the Settings list, then tap Advanced.

If the switch was already on

A page can still fail with JavaScript on. Apple’s same troubleshooting page lists these checks, in this order:

  1. Try another network. Load a site such as apple.com over cellular data, or join a different Wi-Fi network if you don’t have cellular. If a VPN is on, Apple notes that some apps or websites might block content from loading.
  2. Restart your iPhone.
  3. Clear website data. Go to Settings > Apps > Safari, tap Clear History and Website Data, then tap Clear History to confirm. This clears your browsing history too.
  4. Check Private Relay. If the problem affects only one website, Apple suggests checking whether iCloud Private Relay is on; you can turn it off for a while in iCloud settings.
  5. Contact the website. If the site still won’t load after these steps, Apple points you to the website’s developer.

To remove saved data without clearing your history, Apple’s Safari data guide gives another route: Settings > Apps > Safari > Advanced > Website Data > Remove All Website Data > Remove Now. For more ways to do this, see how to delete cookies on iPhone.

Two other settings on the same screens can stop a site from working. Apple says turning on Block All Cookies can prevent signing in to some sites, so if a login loop is the problem, enable cookies in Safari as well.

If you use Lockdown Mode, Apple says certain complex web technologies are blocked, which might cause some websites to load more slowly or not operate correctly. That is a separate protection from the JavaScript switch.

Turning it off again

The same switch turns JavaScript off. If you want to test a page without it or keep it off for a while, see how to turn off JavaScript in Safari on iPhone, which covers what to expect with it off. Pages that depend on it often show a banner asking you to enable JavaScript or leave menus and forms unresponsive; the turn-off guide covers that in detail. For most everyday browsing, leaving it on means fewer pages that half load.

JavaScript on iPhone answers

Is the switch in the same place on an iPad?

Yes. Apple’s Safari troubleshooting page covers iPhone, iPad and iPod touch with the same steps. Safari on a Mac is different; see where the JavaScript setting is in Safari on a Mac.

Why is the Clear History and Website Data button gray?

Apple says the button is gray when there is no history or website data to clear, or when Screen Time web content restrictions are blocking it.