No rewriting of jquery URL
Description
I have a similar issue as described here: #756 The resource 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' is tried to be loaded from the live web. The URL in the replay isn't rewritten.
The error occurs in pywb (2.7.3, tested back to 2.6.8), ReplayWeb.Page and Conifer.
live web: https://tweewhistler.tumblr.com/ Pywb Replay (2.7.3): https://webarchives.rhizome.org/error_tweewhistler_jquery_leak/20221221122039/https://tweewhistler.tumblr.com/
We have a workaround, were we inject the static file (jquery.min.js) to the collection. As you can see, the issue is fixed with a available jquery file. Replay with workaround (pywb 2.7.3): https://webarchives.rhizome.org/Q15396/20221221124329/https://tweewhistler.tumblr.com/
Expected behavior
As you can see in the live web, face rain drops appear on the web page.
What actually happened
- Go to https://webarchives.rhizome.org/error_tweewhistler_jquery_leak/20221221122039/https://tweewhistler.tumblr.com/
Face rain drops are missing.
Error Messages
Error message in dev console (replay):
Uncaught ReferenceError: $ is not defined
Content Security Policy: The page’s settings blocked the loading of a resource at https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js (“default-src”).
Browser
Desktop:
- OS: Ubuntu 22.04
- Browser: Firefox
- Version 114.0.1
It looks like jquery is being live loaded by a bit of JavaScript that writes to the DOM?
<script>if(typeof jQuery=='undefined'){document.write('<'+'script');document.write(' language="javascript"');document.write(' type="text/javascript"');document.write(' src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">');document.write('</'+'script'+'>')}</script>
I'm not certain, but I don't think it's possible to rewrite this on the server side in pywb since it would involve executing random JavaScript? But perhaps it should be getting rewritten on the client side (browser) by wombat?