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

different script for different pages? #230

Open
BigGitWorld opened this issue Nov 15, 2020 · 2 comments
Open

different script for different pages? #230

BigGitWorld opened this issue Nov 15, 2020 · 2 comments

Comments

@BigGitWorld
Copy link

BigGitWorld commented Nov 15, 2020

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 <script> tags are not loaded in new pages.

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?

@zwying0814
Copy link

I have same problem

@BigGitWorld BigGitWorld changed the title different script for different pages? different script for different pages? (it seems the lib does not work anymore) Nov 18, 2020
@BigGitWorld BigGitWorld changed the title different script for different pages? (it seems the lib does not work anymore) different script for different pages? Nov 18, 2020
@memob0x
Copy link

memob0x commented Mar 31, 2021

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...

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

3 participants