Is it possible to change the script execution of clients on a web page?

So I am playing an online game on my laptop and it is a fairly simple html5 game, but the optimization is flawed. Playing with multiple circles on my screen is using 85% of my CPU.

Logically, I started profiling the game and was trying to figure out if I could optimize it for my laptop. Now I'm wondering how I can run the game, but with a modified version of the JS script that works.

If I try to save the page and run it from my laptop, of course it has CORS issues, so I can't access the server.

Can I somehow change the script bit that is executing in my browser but still staying "inside the web page" that works so that I can make XHR requests to the server normally?

Also, while it's not in the title of the question, can I somehow proxy the XHR request to my script without breaking the CORS rule?

Why is it so different if I run the same from my browser and from the saved HTML on my desktop? I have the same IP address and I do the same, but from the url it "feels": "I'm running it from somewhere else. Can I somehow emulate what I'm running" from the web -page "but instead run it from the modified saved html?

+3


source to share


1 answer


A proxy could if there was no cross domain protection mechanism or some kind of login (which complicates the material).

What you could very well do is use a browser extension that allows you to add CSS, HTML and JavaScript.

I'm not really into extensions, so I'm not sure if you can modify existing code, but my guess is that if you can add arbitrary JS code, you could very well replace the script tag containing the game for a similar personally modified script based on it. It's worth trying ...

Link to getting started with chrome extensions

Update:



If you are configured to do this, the proxy will ask for your application url and do something with the page (html) instead of the original one. I am assuming that you want to change the page and send it to your browser.

With that in mind, you'll need the following, I don't know C #, so you'll have to search in libraries and utilities:

  • way to request urls (see link below)
  • way to change the page, you need a DOM crawler
  • a way to start said process and execute it in your browser by clicking on your own url which means you need some kind of web server

I found the following question specifically about proxying with C #

+1


source







All Articles