Why can't I use relative URLs with IE7?

后端 未结 5 2047
臣服心动
臣服心动 2021-01-17 23:50

I\'ve been Googling for a while and can\'t seem to find an answer to this question. My problem is as follows:

For my jquery, I need my links to be relative rather th

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-18 00:30

    Here's a modified version of JKS's answer that uses split instead of substring. A little more elegant IMO:

    stripBaseUrl : function(url){
        var urlArray = url.split("/");
        return urlArray[urlArray.length - 1];
    }
    

提交回复
热议问题