Q:

jquery get current url

var currentURL = $(location).attr('href'); //jQuery solution
var currentURL = window.location.href; // raw javascript
4
var currentURL = $(location).attr('href'); 
var currentURL = window.location.href;
1
window.location.href //returns the href (URL) of the current page
window.location.hostname //returns the domain name of the web host
window.location.pathname //returns the path and filename of the current page
window.location.protocol //returns the web protocol used (http: or https:)
window.location.assign() //loads a new document
0
var pathname = window.location.pathname;
0

New to Communities?

Join the community