2015-09-15 64 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 --> 

它有搜索引擎支持,兼容所有瀏覽器,它可以避免重定向循環。