andrew4582

changePort

Jun 6th, 2011
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function changePort(b) {
  2.     if (window.location.port != b) {
  3.         function c(d) {
  4.             return (d.search(/\[.*?\]/) >= 0)
  5.         }
  6.         var a = window.location.hostname;
  7.         if (c(window.location.host) && !c(a)) {
  8.             a = "[" + a + "]"
  9.         }
  10.         window.location.href = window.location.protocol + "//" + a + ":" + b + window.location.pathname + window.location.search
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment