n测试用例html文件,我也遇到了这个错误。标记的常用方法。很乐意帮忙!:)尝试了这个,但我得到了与之前完全相同的行为:在Firefox中工作(有或没有脚本),但在IE 8中,URL是相同的,就好像没有设置base href一样(即,my base hre
n测试用例html文件,我也遇到了这个错误。标记的常用方法。很乐意帮忙!:)尝试了这个,但我得到了与之前完全相同的行为:在Firefox中工作(有或没有脚本),但在IE 8中,URL是相同的,就好像没有设置base href一样(即,my base hre,html,internet-explorer,Html,Internet Explorer,n测试用例html文件,我也遇到了这个错误。标记的常用方法。很乐意帮忙!:)尝试了这个,但我得到了与之前完全相同的行为:在Firefox中工作(有或没有脚本),但在IE 8中,URL是相同的,就好像没有设置base href一样(即,my base href=“....”,计算出的URL有两个目录级别太深)。太棒了!正是我需要的!实际上,您谈论的是使用以站点为根的路径,这些路径必须以/开头。用/结束它们可能也是个好主意。 A |- HTML_PAGES (contains html
n测试用例html文件,我也遇到了这个错误。
标记的常用方法。很乐意帮忙!:)尝试了这个,但我得到了与之前完全相同的行为:在Firefox中工作(有或没有脚本),但在IE 8中,URL是相同的,就好像没有设置base href一样(即,my base href=“....”,计算出的URL有两个目录级别太深)。太棒了!正是我需要的!实际上,您谈论的是使用以站点为根的路径,这些路径必须以/
开头。用/
结束它们可能也是个好主意。
A
|- HTML_PAGES (contains html files)
|- MEDIA_FOLDER (contains the media used by this html pages)
<base href="../MEDIA_FOLDER"/>
<base href="http://yourdomain.com/MEDIA_FOLDER"/>
<base href="/MEDIA_FOLDER"/>
<base href="../MEDIA_FOLDER"/>
<base href="../MEDIA_FOLDER/"/>
<base href="{BASE_PATH}"><!--[if IE]></base><![endif]-->
<!--[if IE]><script type="text/javascript">
// Fix for IE ignoring relative base tags.
(function() {
var baseTag = document.getElementsByTagName('base')[0];
baseTag.href = baseTag.href;
})();
</script><![endif]-->
<!--[if IE]><script type="text/javascript">
// Fix for IE ignoring relative base tags.
(function() {
var baseTag = document.getElementsByTagName('base')[0];
baseTag.href = window.location.protocol + '//' + window.location.host + baseTag.href;
})();
</script><![endif]-->
(function () {
// Fixes old IE wrong behaiors of the href attribute of the base tag.
var preventIeHrefIgnoring = function (baseTag) {
var docMode = document.documentMode;
var isIe = docMode;
if (!isIe)
return;
if (docMode != 8 && docMode != 9)
return;
// IE8 and IE9 auto-convert path-like values of the href attribute, but do not apply it on the page.
// It is fixed by re-assining.
baseTag.href = baseTag.href;
}
var baseColl = document.getElementsByTagName('base');
if (!baseColl.length)
return;
var baseTag = baseColl[0];
var initialHref = baseTag.href;
if (!initialHref)
return;
var hrefIsUrl = initialHref.indexOf("https://") == 0 || initialHref.indexOf("http://") == 0;
if (hrefIsUrl) {
preventIeHrefIgnoring(baseTag);
return;
}
// Below we are dealing with IE7-5 only.
var targetHref = initialHref.indexOf('/') == 0 ? initialHref : "/" + initialHref;
var resultHref = window.location.protocol + "//" + window.location.host + targetHref;
baseTag.href = resultHref;
})();