1

I have a client who is using SquareSpace, which upon Network inspection, uses a Single Page Application like structure, that is, when clicking a link it doesn't reload the whole page, instead it loads an HTML partial.

The client has a widget on the page from another third-party that uses document.readyState to determine when it should fire, and due to how SquareSpace is loading partials, it never fires.

How can I observe the loading of partials in SquareSpace to modify this widget so it will run when I want it to? I know how to do this within a framework such as Angular, but I'm not sure of the SquareSpace architecture so if there is some reliable client-side way of watching network requests that would be appreciated.

Summer Developer
  • 2,056
  • 7
  • 31
  • 68
  • 1
    Try looking into the webRequest API https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Intercept_HTTP_requests – Simone Nov 27 '17 at 17:22
  • 1
    This can depend on the template (more specifically, the template-family) that is being used. Can you name the template that is being used and/or provide a link to the site in question? For most AJAX-enabled Squarespace templates, this answer will help you: https://stackoverflow.com/questions/42603151/javascript-jquery-not-working-until-after-page-reload/42604055#42604055 . For others, a mutationObserver may be the way to go. – Brandon Nov 27 '17 at 17:24
  • Thank you @Brandon – Summer Developer Nov 27 '17 at 17:33
  • Thanks @Simone will do – Summer Developer Nov 27 '17 at 17:33
  • you can subclass XMLHttpReqest's .send() method and use the clone to trigger your action. – dandavis Nov 27 '17 at 17:37

0 Answers0