{"id":33838,"date":"2021-10-06T17:01:20","date_gmt":"2021-10-06T21:01:20","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=33838"},"modified":"2022-07-14T15:02:49","modified_gmt":"2022-07-14T19:02:49","slug":"ios-safari-extension-stopthescript","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/10\/06\/ios-safari-extension-stopthescript\/","title":{"rendered":"iOS Safari Extension: StopTheScript"},"content":{"rendered":"<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/StopTheScript.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/StopTheScript.html\">\n<p><a href=\"https:\/\/apps.apple.com\/app\/stopthescript\/id1588394487\">StopTheScript<\/a> is my new Safari extension for iOS 15 and iPadOS 15 that stops all JavaScript on your selected websites!<\/p>\n<p>[&#8230;]<\/p>\n<p>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&rsquo;s settings are not available immediately; any settings must be fetched from storage, an async operation. The problem is that the <code>&lt;head&gt;<\/code> of an HTML document may contain <code>&lt;script&gt;<\/code> 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 &ldquo;magic&rdquo; at the very beginning of the document load, even before elements of the <code>&lt;head&gt;<\/code> are loaded. This is why StopTheScript relies on Safari&rsquo;s own extension permission system. Safari users can grant an extension access to specific websites, and only those websites.<\/p>\n<p>[&#8230;]<\/p>\n<p>Will StopTheScript be coming to Safari on the Mac too? I hope so, in the future, but right now it can&rsquo;t, unfortunately. [&#8230;] The problem is that <code>\"run_at\":\"document_start\"<\/code> doesn&rsquo;t work right in Safari on macOS, a bug that I blogged about over a year ago.<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/09\/24\/ios-safari-extension-stopthemadness\/\">iOS Safari Extension: StopTheMadness<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/09\/18\/safari-14\/\">Safari 14<\/a><\/li>\n<\/ul>\n\n<p id=\"ios-safari-extension-stopthescript-update-2021-10-20\">Update (2021-10-20): <a href=\"https:\/\/twitter.com\/kbn_au\/status\/1445197633837015043\">Kyle Nazario<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/kbn_au\/status\/1445197633837015043\">\n<p>If you want to selectively block JavaScript in Safari, try <a href=\"https:\/\/www.nazariosoftware.com\/2021\/04\/07\/about-javasnipt.html\">JavaSnipt<\/a>.<\/p>\n<\/blockquote>\n<p>It works on both iOS and Mac.<\/p>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson: StopTheScript is my new Safari extension for iOS 15 and iPadOS 15 that stops all JavaScript on your selected websites! [&#8230;] 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2021-10-06T21:01:24Z","apple_news_api_id":"edbc506c-66ef-43f2-a8bc-3553757fbac9","apple_news_api_modified_at":"2022-07-14T19:02:52Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/A7bxQbGbvQ_KovDVTdX-6yQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[131,905,31,2078,26,346,30,1891,386,103,2246,2124,96],"class_list":["post-33838","post","type-post","status-publish","format-standard","hentry","category-technology","tag-bug","tag-extensions","tag-ios","tag-ios-15","tag-iosapp","tag-javascript","tag-mac","tag-macos-11-0","tag-mobilesafari","tag-safari","tag-safari-extensions","tag-stopthescript","tag-web"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=33838"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33838\/revisions"}],"predecessor-version":[{"id":33972,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33838\/revisions\/33972"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=33838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=33838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=33838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}