D
D
Dmitry2018-03-02 17:16:48
JavaScript
Dmitry, 2018-03-02 17:16:48

How to dynamically disable included js files?

I connect the script as it runs like this:

var ee = document.createElement("script");
  ee.src = "...";
  ee.type="text/javascript";
  document.getElementsByTagName("head")[0].appendChild(ee);

The question arose, how can now also dynamically disable this file?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alxjzx100, 2018-03-02
@Alxjzx100

parent.removeChild(elem)

C
Coder321, 2018-03-02
@Coder321

From the included script, you export the object or whatever you need to the window parameter, and when you need to delete it, it will be reset to zero.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question