pjax icon indicating copy to clipboard operation
pjax copied to clipboard

different script for different pages?

Open BigGitWorld opened this issue 4 years ago • 2 comments

Hi. I wan to have different <script src> tags in different pages. All of my pages have same DOM (except script tags) and my new HTML content is replaced successfully inside of specified div. But I don't know why these

Therefore I added scrip and script#id to the selectors section to load new script tags, but it results in full page loading. I know this approach is not correct. So, How can I have different <script> sections for different pages?

BigGitWorld avatar Nov 15 '20 13:11 BigGitWorld

I have same problem

zwying0814 avatar Nov 16 '20 16:11 zwying0814

I solved this in the past by comparing the fetched DOM scripts to the current ones, then loading the new ones (the ones not present in the current page) dynamically (either with native import or with a third-party library such as systemjs or requirejs...). While this worked very well for script files, I couldn't find an equally clean solution for inline scripts, for which I ended up using eval...

memob0x avatar Mar 31 '21 00:03 memob0x