Reputation: 91709
If I have different pages that I fetch using PJAX, the scripts I use one the first page I access persist to the second, and any page accessed after that through PJAX.
I've tried resetting functions, and things of the sort, which is too much work. Is it possible that on PJAX page change I can reset all Javascript bindings?
Is partial per-page Javascript possible? (such as retaining jQuery on page change but removing other scripts that are per-page)
Since a Javascript file can be referenced just by appending a <script>
tag, can the opposite be done? (I know that removing that script tag doesn't remove the script)
Upvotes: 3
Views: 2580
Reputation: 385264
Your inner "frames" should not contain any Javascript. You should place all your Javascript in functions that are available at the very top level of your page, and then you can hook in to page changes using the PJAX API to enable/disable functionality as appropriate.
Upvotes: 1