How to automatically append gwt.codesvr to page URL

丶灬走出姿态 提交于 2019-12-06 03:09:20

Since I'm dealing with 'Places' all the time now I updated the bookmarklet to deal with '#' too.

javascript:(function(){h="localhost";p="9997";l="gwt.codesvr="+h+":"+p;s=false;if(document.location.href.indexOf("gwt.codesvr")<0){q=document.location.href.indexOf("?");if(q<0){q=document.location.href.indexOf("#");if(q>0){q=q-1}s=true}if(q<0&&!s){document.location.href=document.location.href+"?"+l}else%20if(q>=0&&!s){b=document.location.href.substr(0,q+1);e=document.location.href.substr(q+1);document.location.href=b+l+"&"+e}else{b=document.location.href.substr(0,q+1);if(q<0){e=""}else{e=document.location.href.substr(q+1)}document.location.href=b+"?"+l+e}}})();

Update 2/7/2017- There had been a typo in the script. Corrected it.

I made a bookmarklet that I click to debug the current page:

javascript:window.location+=(window.location.href.indexOf('?')==-1?"?":"&")+"gwt.codesvr=localhost:9997"

but that doesn't account for the hash at the end, which you may not need anyway. That bookmarklet is about the only thing I use my bookmarks bar for...

Possibly worth pointing out that this can be used even with a production server, as long as you have roughly the same client code locally that that server was running.

Since you'll be using that url only for development (and maybe few times for remote debugging), just bookmark http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997 (or whatever port you use).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!