強迫 Blogger (Blogspot) 使用 blogspot.com 的網域 (而非 .tw)

在「Prevent Blogger from Redirecting your Blogspot Blog to Country-Specific URLs」這篇文章裡提到了 Blog 的擁有人要怎麼避免 Google 把網址導到 country-based 的網域下。

目前 Google Chrome 的使用者端可以安裝「NoCountryRedirect (NCR)」這個套件來避開這個問題,但你總不能要求每個人都裝套件...

而這篇文章則說明了如何在 Blogger 裡插入一段 javascript 避免使用 country-based domain:

<script type="text/javascript">
 
  // Written by Amit Agarwal
  
  /* Get the full URL of the current blogger page */  var blog = document.location.href.toLowerCase();
 
  /* Do not redirect if the domain is .com already */  if (!blog.match(/\.blogspot\.com/)) {
 
    /* Replace the country TLD with .com and ncr switch */    blog = blog.replace(/\.blogspot\..*?\//, ".blogspot.com/ncr/");
 
    /* Redirect to the new .com URL in the current tab */    window.location.replace(blog);
  }
 
  // Source: http://labnol.org/?p=21031
  
</script>

這樣做的好處主要是來自於 url 統一,對於統計、廣告以及分享的問題會減少很多。

拿掉 Blogger 的 Country Redirect

在台灣看 Blogger 時會被導到 blogspot.tw 網域,目的是為了要能夠支援 content filter,也就是「Why does my blog redirect to a country-specific URL? (ccTLD)」裡的這段:

Q: Why is this happening?
A: We are doing this to provide more support for managing content locally. If we receive a removal request that violates local law, that content may no longer be available to readers on local domains where those laws apply. This update is in line with our approach to free expression and controversial content, which hasn’t changed.

後來在 Chrome Web Store 上翻到可以透過 NCR 固定在 blogspot.com domain 上的方法了:「NoCountryRedirect (NCR)」,透過 /ncr 重導設定 NCR cookie...