最近在做移動端的時候,碰到了一個問題,就是點擊返回按鍵,使用history.go(-1)或history.back(-1)不能夠生效。於是便尋找其他的方法,終於找到了一位大神的方法如下:
if(window.document.referrer==""||window.document.referrer==window.location.href){ window.location.href="{dede:type}[field:typelink /]{/dede:type}"; }else{ window.location.href=window.document.referrer; }
但是這樣做的問題是必須開啟服務器的情況下才能生效。