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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -