1

I'm working on a website where the page doesn't load the url just changes and the pages shows up. I added a JavaScript code to the page but the code only runs when I refresh the page and not when I click the link to get to the page. Can someone help me out?

This is the code:

<script>
var idcomments_acct = '83e4fbf73e5268d6ddbbabd9e697add5';
var idcomments_post_id;
var idcomments_post_url;
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='https://www.intensedebate.com/js/genericCommentWrapperV2.js'>
</script>
  • 1
    could you provide more code about your question?? the code you posted didn't show any problem about you description... – Horken Jun 29 '17 at 03:10

1 Answers1

1

In Squarespace, when your custom Javascript only works after a page refresh, it most likely has to do with Squarespace's AJAX loading:

Occasionally, Ajax may conflict with embedded custom code or anchor links. Ajax can also interfere with site analytics, logging hits on the first page only.

You may be able to disable AJAX for your template. Or, see the other approaches outlined here: https://stackoverflow.com/a/42604055/5338581

Brandon
  • 3,572
  • 2
  • 12
  • 27