how to fix the window.location.origin problem in Internet Explorer

In some JavaScript i used the window.location.origin statement to build an url. It worked fine on every browser except the Internet Explorer. Whenever I tryed to call the origin an 'undefined' was the result. After some trys I figured our there is a workaround to build your own origin.

1
2
3
if (!window.location.origin) {
  window.location.origin = window.location.protocol + "//" + window.location.hostname;
}

Comments

Popular posts from this blog

How to support multiple languages in WPF