Blocking Domains Safari Developer Tools

Is there a way from the Safari Developer tools to prevent certain scripts from loading on a website?


I am working locally on a site. My work depends on loading jQuery on-site via a script tag. However, there is a third party vendor loading scripts on-site that prevents my jQuery library from loading. Is there way to block specifc third party domains from loading scripts on-site from the Safari Developer Tools?


Thanks!

Replies

Hello sethbass14,

In Safari 13.1 and later, you can use local overrides to stub out any resource you don't want to load, such as the 3rd party scripts. In this case, it may be easiest to create a local override using a regular expression to rewrite all responses for a domain to return an empty file. Visit the following page to learn more about this feature:

https://webkit.org/web-inspector/local-overrides/

And this will be covered in a WWDC session this week:

https://developer.apple.com/videos/play/wwdc2020/10646/

Thanks!
BJ