JavaScript is on by default in Safari, but you can turn it off and back on in Settings
Safari enables JavaScript automatically when you install it. If a website isn't working properly — buttons don't respond, content won't load, forms freeze — JavaScript might be turned off. You can check this in Safari's settings and turn it back on in about 30 seconds.
The steps differ slightly between Safari on Mac and Safari on iPhone or iPad, but both routes are straightforward. You don't need to restart Safari or clear anything after you change the setting.
Key Takeaways
- JavaScript is enabled in Safari by default, so you only need to change this setting if a website told you to or if you deliberately turned it off.
- On Mac, open Safari Preferences, go to the Security tab, and check the box next to "Enable JavaScript".
- On iPhone or iPad, go to Settings > Safari > Advanced and toggle JavaScript on.
- After you enable JavaScript, refresh the website you were viewing and it should work normally.
- Some websites may still not work if they require features beyond basic JavaScript, but this setting covers the vast majority of sites.
Enabling JavaScript on Mac Safari
Open Safari and click Safari in the menu bar at the top of your screen. Select Preferences from the dropdown menu. A window will open with several tabs across the top.
Click the Security tab. You'll see a checkbox labeled Enable JavaScript. If the box is empty, click it to turn JavaScript on. If it's already checked, JavaScript is already enabled and the problem lies elsewhere. Close the Preferences window when you're done.
Go back to the website that wasn't working and refresh the page by pressing Command+R or clicking the refresh button in the address bar. The page should now load properly if JavaScript was the issue.
Enabling JavaScript on iPhone or iPad Safari
Open the Settings app on your device. Scroll down and tap Safari. Scroll to the bottom of the Safari settings page and tap Advanced.
You'll see a toggle switch next to JavaScript. If it's gray, tap it to turn JavaScript on. The toggle will turn green when it's enabled. Close Settings and return to Safari.
Refresh the website by pulling down on the page and releasing, or by tapping the refresh icon. The page should now work if JavaScript was disabled.
Why a website might not work even with JavaScript on
Some websites require features beyond basic JavaScript, such as WebGL for 3D graphics or WebAssembly for complex processing. Enabling JavaScript won't fix these. Other sites may have bugs or may not support older versions of Safari.
If a website still doesn't work after you enable JavaScript, try opening it in a different browser like Chrome or Firefox to see if the problem is specific to Safari. If it works in another browser, the issue is a compatibility problem between that site and Safari, not your JavaScript setting.
When you might want to turn JavaScript off
Some people disable JavaScript to block ads or tracking scripts, though this breaks many websites. If you're considering turning it off, know that you'll lose functionality on most modern sites — shopping carts won't work, videos won't play, and interactive features will disappear.
If you want to block ads or trackers without disabling JavaScript entirely, Safari's built-in privacy features are a better choice. Open Safari Preferences on Mac, go to the Privacy tab, and check Prevent cross-site tracking. On iPhone or iPad, go to Settings > Safari and toggle on Prevent Cross-Site Tracking. These options let you browse normally while reducing the amount of data websites collect about your activity.
Troubleshooting if JavaScript is already on
If JavaScript is already enabled but a website still isn't working, try clearing Safari's cache. On Mac, click Safari in the menu bar, select Clear History, choose how far back to clear, and click Clear History. On iPhone or iPad, go to Settings > Safari and tap Clear History and Website Data.
If clearing the cache doesn't help, the website itself may be having problems, or it may require a newer version of Safari than you have. Check the App Store to see if a Safari update is available. If you're on an older Mac or iOS device that can't update Safari, some websites simply won't work no matter what settings you change.
Frequently Asked Questions
Will turning on JavaScript slow down Safari?
No. JavaScript runs in the background and doesn't noticeably affect Safari's speed. Websites that use JavaScript efficiently load and run normally. If a site feels slow, the problem is usually the website itself, not JavaScript.
Is JavaScript a security risk?
JavaScript runs only within your browser and can't access your files or install software on your device. Safari's security features limit what scripts can do. The risk is minimal for normal browsing, though some people disable it for extra caution on untrusted sites.
Do I need to restart Safari after enabling JavaScript?
No. The setting takes effect immediately. Just refresh the page you were viewing and it should work.
Why would I have turned JavaScript off in the first place?
Most people don't. JavaScript is on by default. You might have disabled it if you were troubleshooting a problem, if someone told you to, or if you were trying to block ads or tracking. If you don't remember turning it off, it's probably still on.