B
B
bestime2018-02-11 01:06:19
JavaScript
bestime, 2018-02-11 01:06:19

How to block js file reconnection?

Hello.
I have been struggling with the following problem for a long time:
There is a main page with a menu, ajax other pages are loaded into it.
Each loaded page has its own script file.
If I go to the page once, then everything is fine.
If you go to another page and return, the script file will be loaded again and it will turn out that it is duplicated, and when you perform some action on the page, it is executed 2 times. How to determine that this script file has already been loaded and it is unnecessary to load it again?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Litvinenko, 2018-02-11
@edli007

you need webpack and include this file as a module

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question