2015-09-15 83 views
0

我正在使用元标记重定向我的Blogger页面,但重定向发生在旧Blogger后发生重定向。Blogger首次加载完成后会发生Blogger重定向?

有没有什么办法可以重新定向而不需要先完整加载旧的Blogger页面?

我用我的模板的标头部分以下代码:

<meta content='0;URL=&apos;http://newsite.com' http-equiv='refresh'/>  
+0

meta标签的位置很重要,试着在模板中启动head标签后添加它,然后您应该看到相当大的差异 –

回答

0

你应该打开head标签后马上将您重定向代码。这种JS redirect code发电机将帮助你处理这种情况。你不应该使用纯HTML meta重定向,但是这所有功能于一身的解决方案:

<!-- Pleace this snippet right after opening the head tag to make it work properly --> 

<!-- This code is licensed under GNU GPL v3 --> 
<!-- You are allowed to freely copy, distribute and use this code, but removing author credit is strictly prohibited --> 
<!-- Generated by http://insider.zone/tools/client-side-url-redirect-generator/ --> 

<!-- REDIRECTING STARTS --> 
<link rel="canonical" href="http://newsite.com"/> 
<noscript> 
    <meta http-equiv="refresh" content="0;URL=http://newsite.com"> 
</noscript> 
<!--[if lt IE 9]><script type="text/javascript">var IE_fix=true;</script><![endif]--> 
<script type="text/javascript"> 
    var url = "http://newsite.com"; 
    if(typeof IE_fix != "undefined") // IE8 and lower fix to pass the http referer 
    { 
     document.write("redirecting..."); // Don't remove this line or appendChild() will fail because it is called before document.onload to make the redirect as fast as possible. Nobody will see this text, it is only a tech fix. 
     var referLink = document.createElement("a"); 
     referLink.href = url; 
     document.body.appendChild(referLink); 
     referLink.click(); 
    } 
    else { window.location.replace(url); } // All other browsers 
</script> 
<!-- Credit goes to http://insider.zone/ --> 
<!-- REDIRECTING ENDS --> 

它有搜索引擎支持,兼容所有浏览器,它可以避免重定向循环。