I have a string like this
http://www.example.com/xyz/filename.php
Now I just want to get the string http://www.example.com/
how can I do this ?
I know this is a simple question but I have tried its not working
Thanks in Advance
I have a string like this
http://www.example.com/xyz/filename.php
Now I just want to get the string http://www.example.com/
how can I do this ?
I know this is a simple question but I have tried its not working
Thanks in Advance
Try this:
var $url = 'http://www.example.com/css/filename.php';
var a = document.createElement('a');
a.href = $url;
var $finalUrl = a.protocol + '//' + a.hostname + '/';