jquery change replace url
with the same principle than this script, how could i change a url
from
http://开发者_开发问答abc.com/radiofr/my/Person.aspx?accountname=radiofr\Administrateur
to
http://abc.com/radiofr/intranet/_layouts/rf.portal.web/person.aspx?accountname=radiofr\Administrateur
why not just replace the /my/
var s='http://abc.com/radiofr/my/Person.aspx?accountname=radiofr\Administrateur';
alert(s.replace(/\/my\//,'intranet/_layouts/rf.portal.web/'));
Simply get the pathname using plain old javascript location If you want to get just the last part you can use location.pathname replace the bit required
var href = location.href;
href.replace("radiofr/my", "radiofr/intranet/_layouts/rf.portal.web");
Note : grabbed the url with javascript as not entirely sure what the purpose of this action is and whether the url is a known string at that point
精彩评论