JavaScript is usually on by default in Safari, but you may need to turn it back on if a website stops working or if you disabled it yourself
JavaScript is a programming language that websites use to make interactive features work — things like dropdown menus, image sliders, live chat boxes, and forms that check your input before you submit. Without it, many modern websites either look broken or won't let you do what you came to do.
Safari has JavaScript enabled by default on all recent versions (Safari 12 and newer). If a website isn't working the way it should, JavaScript is rarely the problem. But if you or someone else turned it off, or if you're using an older Mac, you'll need to turn it back on in Safari's settings.
Key Takeaways
- JavaScript is turned on by default in Safari 12 and newer, so you only need to change this setting if you deliberately turned it off.
- To turn JavaScript on, open Safari, click Safari in the menu bar, select Preferences, go to the Security tab, and check the box next to "Enable JavaScript".
- If you're on an older Mac running Safari 11 or earlier, the setting is in the same place but may look slightly different.
- After you turn JavaScript on, you may need to refresh the website you were viewing by pressing Command+R.
How to turn JavaScript on in Safari on Mac
Open Safari and click Safari in the menu bar at the top of your screen. A dropdown menu will appear. Click Preferences (or Settings if you're on macOS Sonoma or newer).
A new window will open. Click the Security tab at the top. You'll see a checkbox next to "Enable JavaScript". If the box is empty, click it to turn JavaScript on. If the box already has a checkmark, JavaScript is already on and you don't need to do anything.
Close the Preferences window. The change takes effect when ready. If you were on a website that wasn't working, go back to that page and refresh it by pressing Command+R on your keyboard.
How to turn JavaScript on in Safari on iPhone or iPad
Open the Settings app on your device (not Safari itself). Scroll down and tap Safari. Scroll down again until you see Advanced at the bottom and tap it.
Tap the toggle next to JavaScript to turn it on. The toggle will turn green. Go back to Safari and refresh the page you were viewing by tapping the refresh icon (the circular arrow) in the address bar.
What to do if JavaScript is on but websites still aren't working
If you've confirmed that JavaScript is enabled and a website still isn't working properly, the problem is usually something else. Try refreshing the page first by pressing Command+R (Mac) or tapping the refresh icon (iPhone or iPad). Wait a few seconds for the page to fully load.
If that doesn't work, try closing Safari completely and opening it again. Sometimes a website's code has a temporary error that goes away when you reload. If the same website doesn't work in Safari but works in another browser like Chrome or Firefox, the issue is specific to Safari and not something you can fix yourself — you would need to contact the website's support team.
Why you might have turned JavaScript off
Most people never intentionally disable JavaScript because it breaks too many websites. But some people turn it off for privacy reasons, thinking it makes them harder to track online. This is only partly true — JavaScript does allow websites to collect more information about you, but disabling it also makes most websites unusable.
If you're concerned about privacy and tracking, turning off JavaScript is too blunt a tool. A better approach is to use Safari's built-in privacy features: go to Preferences > Privacy and check "Prevent cross-site tracking". You can also use private browsing mode (File > New Private Window) when you don't want Safari to save your history.
Checking JavaScript on older Macs
If you're using Safari 11 or earlier (on macOS Sierra, High Sierra, or Mojave), the process is almost the same. Open Safari, click Safari in the menu bar, and click Preferences. Click the Security tab. The checkbox for JavaScript will be in the same place.
If you're still using Safari 10 or older, you should consider updating your Mac if possible. Older versions of Safari have security vulnerabilities that put your personal information at risk. Check the Apple menu and click "About This Mac" to see which version of Safari and macOS you have.
Frequently Asked Questions
Will turning on JavaScript slow down Safari?
No. JavaScript runs in the background and you won't notice a speed difference. If anything, websites load faster because all their features work properly instead of timing out or showing errors.
Is JavaScript the same as Java?
No, they are completely different. Java is a separate programming language used for different purposes. You don't need Java to use the internet, and turning off JavaScript has nothing to do with Java.
Can I turn JavaScript on for some websites and off for others?
Safari doesn't have a built-in way to do this. JavaScript is either on for all websites or off for all websites. If you need fine-grained control, you would need to use a different browser or a browser extension designed for this purpose.
What if I don't remember turning JavaScript off?
Someone else using your device may have changed the setting, or a software update may have reset it. Either way, the fix is the same: go to Safari Preferences, click Security, and check the JavaScript box.