Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am trying to find an solution to an idea i have, below is a snippet of JS/Regex that is saved in a book mark link and when the user goes to www.example.com and clicks on the bookmark, the JS initializes and switches the link to preview-www-example-com.dmzexample.com(internal preview environment). Now recently our servers/arch have upgraded/changed, and im having to modify the switcher. What i want to do is use a chrome app/extension that when clicked on opens a dialog box you input the url and you select a prevew check box or a live check box and click a submit button that takes you to the requested site.
Also with the new servers i have to add a port number that is dependent on the site, so say example.com:80 example2.com:8081 this can be another text field in the app as the clients will know port number. If you have any other ideas that would help accomplish my goals please let me know. Thanks and Happy coding :)
JavaScript
javascript:(function(h){rd = (h.host.indexOf("preview-") == -1) ? "preview-" + h.host.replace(/\./g,"-") + ".dmzexample.com" + h.pathname : h.host.replace("preview-","").replace(".dmzexample.com","").replace(/-/g,".").replace(/.9/,"-9") + h.pathname; window.location = h.protocol + "//" + rd;})(location)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900