javascript - I want to specific a host of http request, can Greasemonkey help me to do this job? -
i have search "dns" , "host" in userscripts.org, can't found answer.
sometimes want test in development enviroment, example, 192.168.22.11 testfunc.mydomain.com
but don't want change c:\windows\system32\drivers\etc\hosts file time , restart browser.
the question not clear.
you want locally reroute mydomain.com
192.168.22.11?
greasemonkey can automatically reload pages, changing server or ip, don't recommend that. messy endeavor -- handling href
, src
attributes, etc.
if read question correctly, redirector add-on better fit.
~~~
however, proper way structure site , apps uses relative addresses, amap. use single bit of code detect running server, once per request (or once per app init), , set <base>
element and/or appropriate global variable.
the point our code runs without changes whether it's dropped on productionserver.com, or testserver.com, or 192.168.22.11
. so, there no need redirects, or slight modifications between test code , production code.
Comments
Post a Comment