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
Post a Comment