How to Disable JavaScript in the Safari Web Browser

If you're concerned about security with JavaScript, disable it

JavaScript adds dynamic behavior to websites, which enhances them and provides a friendlier experience to the viewers. However, because JavaScript is a powerful programming language, people can also use it to write malware, which has made it unwelcome by many computer users.

JavaScript is enabled by default in the Safari browser on Mac computers and Apple's iPhone and other mobile devices. If you don't want to run it for security reasons, you can turn it off in the Mac's System Preferences screen or the iPhone's Settings app.

This article applies to all versions of Safari and devices running iOS 7 and later.

How to Disable JavaScript in Safari on a Mac

In Safari on Mac, you can enable and disable JavaScript in the Preferences menu.

  1. Open Safari.

  2. Open the Safari menu and click Preferences.

    The keyboard shortcut for Preferences is Command+, (comma).

    Safari on a Mac with the Preferences menu item highlighted
  3. Click the Security tab.

    Safari Preferences with the Security tab highlighted
  4. Remove the check from the box in front of Enable JavaScript to disable the feature.

    Security preferences in Safari with the Enable JavaScript box highlighted

Some websites may not function as expected while JavaScript is disabled.

How to Disable JavaScript in Safari on an iPhone

On your iPhone or another iOS device, you disable JavaScript in the Settings app:


  1. Open the Settings app.

  2. Scroll down to Safari and tap it.

  3. At the bottom of the Safari settings screen, tap Advanced.

  4. Tap the slider next to JavaScript to toggle it to the off position.

    iOS settings with JavaScript toggle highlighted