To get the url name and redirect in jQuery -
i using below code getting current url in jquery.
var pathname = window.location.pathname; console.log(pathname);
now have got url this
http://localhost/tantraprojects/collectivecraft/repo/website/index.php/crafts/t-lights.html
i want convert url this
http://localhost/tantraprojects/collectivecraft/repo/website/index.php
is there way convert url above, whatever url ?
assuming index.php in url , want remove after index.php, following code work:
var url='http://localhost/tantraprojects/collectivecraft/repo/website/index.php/crafts/t-lights.html'; var b= url.split('index.php'); var newurl=b[0]+'index.php'; document.write(newurl);
Comments
Post a Comment