Wednesday, October 6, 2021

iOS Safari Extension: StopTheScript

Jeff Johnson:

StopTheScript is my new Safari extension for iOS 15 and iPadOS 15 that stops all JavaScript on your selected websites!

[…]

If you install StopTheScript, you may find it strange that the extension has no settings. This is a technical limitation. Why? When a Safari extension is loaded into a web page, the extension’s settings are not available immediately; any settings must be fetched from storage, an async operation. The problem is that the <head> of an HTML document may contain <script> elements. If StopTheScript had to wait for settings to be fetched from storage, then it might be too late to stop the JavaScript from running already! Thus, StopTheScript has to do its “magic” at the very beginning of the document load, even before elements of the <head> are loaded. This is why StopTheScript relies on Safari’s own extension permission system. Safari users can grant an extension access to specific websites, and only those websites.

[…]

Will StopTheScript be coming to Safari on the Mac too? I hope so, in the future, but right now it can’t, unfortunately. […] The problem is that "run_at":"document_start" doesn’t work right in Safari on macOS, a bug that I blogged about over a year ago.

Previously:

Update (2021-10-20): Kyle Nazario:

If you want to selectively block JavaScript in Safari, try JavaSnipt.

It works on both iOS and Mac.

Comments RSS · Twitter

Leave a Comment