Reputation: 671
I'm debugging a CSS/JS problem on a live website, and in this situation it is unfeasible to clone the entire production system onto a local machine to fiddle with 2 lines of code.
I would LOVE it if there were a simple way to trick a browser (FF, Chrome, anything - I'm not fussy) into loading the live site but redirecting certain internal URLs to a local webserver. Any ideas?
eg. I want to load the entire live website, except one specific Javascript file. The attempt to access http://...production.../js/map.js
should be rerouted to http://localhost/debug/js/map.js
, which I can edit locally until the problem is fixed.
Upvotes: 1
Views: 856
Reputation: 21842
For future readers I would like to answer this question. Have a look at
You can setup a Redirect Rule Request following these steps:
Disclaimer: I have created this So you can blame me if you do not find this helpful :)
Upvotes: 1
Reputation: 671
I have found a Chrome extension which, despite its bugs, achieves precisely this behaviour. DevTools Redirect: https://chrome.google.com/webstore/detail/devtools-redirect/jmhdebkkippcccflcoddckhjjfgnfhnp
This allows developers to specify JS or CSS files to redirect, and a new URL to grab them from (eg. http://localhost/.../debug.js
).
Upvotes: 1
Reputation: 8002
You can do this with fiddler.
Use the AutoResponder to intercept URLs and return content from local file or different server.
Upvotes: 1
Reputation: 66304
Edit re-read your issue, if you aren't happy to find/edit the SQL database for the file in question, you could always just add an adblock rule against it, and manually run your own script from console/greasemonkey it in.
Answer to question in the title:
HTML5 has a feature called an "application cache" just for this. It involves adding a manifest attribute to your <html>
tag.
<html manifest="what_to_cache.appcache">
Then in what_to_cache.appcache
,
CACHE MANIFEST
http://...production.../js/map.js
Future requests of items listed in the manifest will thereafter be loaded from the cache, if available, even if the user is offline. The file is stored in an SQL database for that website, so you can thereafter edit the database.
Upvotes: 2