different script for different pages? #230

Closed
opened 2020-11-15 08:34:41 -05:00 by BigGitWorld · 2 comments
BigGitWorld commented 2020-11-15 08:34:41 -05:00 (Migrated from github.com)

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?

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 commented 2020-11-16 11:10:48 -05:00 (Migrated from github.com)

I have same problem

I have same problem
memob0x commented 2021-03-30 19:28:33 -05:00 (Migrated from github.com)

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

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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#230