87878/how-to-get-the-url-without-any-parameters-in-javascript
If I use:
alert(window.location.href);
I get everything including query strings. Is there a way to just get the main url part, for example:
http://edureka.co/somedir/somefile/
instead of
http://edureka.co/somedir/somefile/?foo=bar&loo=goo
Hello @kartik,
This is possible, but you'll have to build it manually from the location object:
location.protocol + '//' + location.host + location.pathname
Hope it helps!! Thank you!!
Hello @kartik, To use params simply append them ...READ MORE
Hello @kartik, Use: var host = window.location.hostname; or possibly var host ...READ MORE
Hello @kartik, Use the browser history to change ...READ MORE
Hello @kartik, Use this code window.onhashchange = function() { ...READ MORE
Hello, In the error callback or $.ajax you have three ...READ MORE
Hello @kartik, If your script is called myScript.js ...READ MORE
Hello @kartik, Try this code : // Create an ...READ MORE
Hello @kartik, Use node-inspector from any browser supporting WebSocket. Breakpoints, ...READ MORE
Hii, This works in all browsers: window.location.href = '...'; If ...READ MORE
Hello @kartik, Use: window.location.href As noted in the comments, ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.