krux / postscribe

Asynchronously write javascript, even with document.write.
MIT License
986 stars 156 forks source link

Ability to unload javascript includes? #483

Open zhuber opened 4 years ago

zhuber commented 4 years ago

If you have an application that allows users to drop in javascript includes, it may pull in third-party scripts that you do not want hanging around in the browser. After testing with this it seems like any js assets loaded in through this system are stored in browser memory and there is no way that I can see to unload them. This is really concerning, given that people can paste in any sort of script and we would then need to trust those scripts to act in a legal manner when staying in the users browser for the entire session.

Is there a way to encapsulate the js includes in such a way that they can be removed when a user changes pages, or we remove the component that originally contained the js include?

soniar4i commented 2 years ago

Hi @zhuber did you end up finding a solution? I'm facing the same problem while using the library to load external scripts to an SPA.

brightertools commented 2 years ago

Hi @zhuber & @soniar4i

Is it possible to remove script from the DOM using react? ie remove tracking code from specific pages after its been added?

Thanks