Skip to content Skip to sidebar Skip to footer

Javascript Stream Wrapper, Intercept Js File Contents

In PHP there's a function called stream_wrapper_register. With that i can get the file contents of every PHP file that is about to be included. So that basically gives me control o

Solution 1:

No, you can't. Alone for security reasons you won't be allowed to get every script's content.

For Opera, there is a special BeforeScript event which can be listened to from local user scripts.

So there is no (good) way to detect (dynamically added) <script> elements in a page and prevent them from loading and executing a script. Yet you could load the script files by ajax, respecting the same-origin-policy (!), and evaling their modified contents as @DavidEllis suggested.

Elsewise, you need to proxy all script inclusions over your server and modify them there.

Post a Comment for "Javascript Stream Wrapper, Intercept Js File Contents"