javascript - How to get url dynamically in HTML page using DOJO -


for example, have 2 url's: supposed enter in .jsp page, when enter these url's, browser internally navigate index.html page(this index.html should not displayed) , should read url dynamically , should redirect corresponding .jsp page based on server name.

www.server01/demo/../com

www.server02/demo/../com

something below should work, replace values server1 , server2 relevant server names

<head>     <script type="text/javascript">     var hostname = window.location.hostname;          if( hostname == "server1" )     {          window.location="server1/page1.jsp";     }     else if ( hostname == "server2")     {         window.location = "server2/page2.jsp";     }      else {         alert('page not found');     }     </script> </head> 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -