Jump to content

Injecting own JS to page?


Christopher.Burkhouse

Recommended Posts

So here's my problem. I'm trying to test my website for exploits. What I'm testing for requires me to modify some JS at startup. I tried in the dev tools 'inspect element' section of Chrome, but refreshing, as I'm sure you all know, resets the JS. What I need is to replace a JS page (it links to an external JS page) with my own (or remove the one included and include my own between the header). Is there a tool which allows this? I imagine if a tool let's you replace /js/functions.js with a local functions.js, this would be the easiest route. My problem is I haven't found anything that works. I hope I'm making sense. If I don't, please let me know what I can clarify. I'm pretty new to JS injection in this form. It just needs to inject the JS at page load hence the need to be able to refresh and have it use my specific JS from the get-go.

Link to comment
Share on other sites

In the DOM inspector, you can change the src attribute of any <script> element on the page.

 

If you want to execute your own Javascript on the page you can write code right into the console.

Link to comment
Share on other sites

That doesn't work in this case, though. I need to stop the page from pulling a specific JS file, and use mine instead, so I can customize the functions. Is something like this even possible? To explain, I can't modify the JS after the page has been loaded, I need my JS to load with the page. It's because of the way the functions operate.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...