html - Get current dynamic URL with Javascript -



html - Get current dynamic URL with Javascript -

been trying run jquery functions based on dynamic url having issues.

say html file called mypage.html

this code using check url

var pathname = window.location.pathname; var splitpath = pathname.split("?"); var input = splitpath[splitpath.length-1]; console.log(pathname);

i looking @ file locally, , when set in browser /pathname/mypage.html console outputs /pathname/mypage.html expecting.

but now, if alter url /pathname/mypage.html?input=yes page loads fine, console still logs /pathname/mypage.html meanwhile see input=yes

what doing wrong here?

document.location.search returns next ?.

javascript html

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -