所以我下面的代码适用于所有浏览器,但是在 IE8 和 IE7 中,链接似乎没有保留文本。
正在发生的事情的示例:
<a href="http//site.com/">view site</a>
在我在 IE 中的代码之后
<a href="http//site.com/">http//site.com/</a>
我做了一些搜索,并且记录了多个问题错误。
我正在使用 jQuery 1.4.2,但也尝试了 1.10 并没有区别。
var replacer = $('.ir a, .tk a');
//apply menu to inner links
$(replacer).each(function () {
//get page param with getmenu
var getmenu = location.href.split("&menu")[1];
if (typeof getmenu === 'undefined') {
getmenu = "&menu=1";
};
var attr = $(this).attr("href");
$(this).attr("href", attr + getmenu);
});