funp中文網址推文亂碼ie6和wordpress
2008/11/11 此問題funp已解決
問題:
Wordpress使用固定網址及文章標題為連結設定,在ie6上經funp快看的轉址,會出現404找不到網頁。
以文章標題太陽能產業發展為例:
在搜尋引擎或是網站上的連結,它點擊下去的位址是:
但在funp快看卻是:
https://www.diimii.com/2008/09/太é½è½ç¢æ¥ç¼å±/
解決:
於404.php中加入判斷代碼,並重新轉址至正確文章位址。
<script type="text/javascript"> if (checkBrowser().ie6 && document.referrer.indexOf('funp.com')>-1) location.href = document.location.pathname; function checkBrowser() { this.ver = navigator.appVersion; this.dom = document.getElementById?1:0; this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie4 = (document.all && !this.dom)?1:0; this.ns5 = (this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4 = (document.layers && !this.dom)?1:0; this.mac = (this.ver.indexOf("Mac") > -1) ?1:0; this.ope = (navigator.userAgent.indexOf("Opera")>-1); this.ie = (this.ie6 || this.ie5 || this.ie4); this.ns = (this.ns4 || this.ns5); this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope); this.nbw = (!this.bw); return this; } </script>
參考資料:
用javascript轉UTF-8編碼 | Javascript Reference | WordPress Custom Queries
附註:
新版瀏覽器如ie7和firefox2支援中文位址,經測試無此亂碼問題。