我跟隨Jeffery Way的history.pushState tutorial on Tuts+,但是我無法得到他的結果。頁面上沒有檢測到JavaScript(history.pushState)
基本上,這是我的測試頁面:http://leongaban.com/_tuts+/HTML5/
可以在頁面底部的腳本,網址是假設看起來像http://leongaban.com/_tuts+/HTML5/page但是什麼也沒有發生,也是在Chrome和Firefox的開發工具都告訴我頁面上沒有JavaScript?
我滿標記(與傑弗裏的):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>History – pushState</title>
</head>
<body>
<ul>
<li><a href="http://d2o0t5hpnwv4c1.cloudfront.net/2086_get-good-with-php/preview.png" title="Rockable">Rockable</a></li>
<li><a href="http://tutsplus.s3.amazonaws.com/bestof/bestoftuts.jpg" title="Best">Best of Tuts</a></li>
<li><a href="http://net.tutsplus.com/wp-content/uploads/2012/06/200x200.png" title="Advanced JS">Advanced JS</a></li>
</ul>
<script type="text/javascript">
history.pushState(
'Some data'
'My Page Title'
'page'
);
</script>
</body>
</html>
<!--
<script>
history.go(-1); < Go back 1 page
history.go(2); < Go forward 2 pages
history.go(0); < Refresh current page
history.forward(); < Forward 1 page
history.back(); < Back 1 page
</script>
-->
它看起來並不像你加載JavaScript文件中的變量。 – 2012-07-26 15:45:03
我的控制檯在參數列表/ _tuts +/HTML5 /:23「 – TheZ 2012-07-26 15:45:07
之後顯示代碼中有錯誤」缺少)在'pushState'的每個參數後需要逗號。 – 2012-07-26 15:46:02