Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No rewriting of jquery URL #851

Open
mona-ul opened this issue Jun 22, 2023 · 1 comment
Open

No rewriting of jquery URL #851

mona-ul opened this issue Jun 22, 2023 · 1 comment

Comments

@mona-ul
Copy link

mona-ul commented Jun 22, 2023

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

  1. 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
@edsu
Copy link
Contributor

edsu commented Jun 22, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants