Javascript examples for String Operation:String Substring
Getting the part of string from the URL as path
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> (function () {/*from w ww. ja v a 2 s .c om*/ var location = { href: 'http://localhost:8080/MyApp/MyScreen?userName=ccc' }; var baseUrl = "http://localhost:8080/MyApp"; var pagePath = location.href.replace(baseUrl, ""); console.log(pagePath); })(); </script> </body> </html>