我在这里有这个代码:
<script type="text/javascript">
function goFunction(){
history.pushState("google.ca", "GOOGLE CANADA", "http://www.google.ca");
return event.preventDefault();
}
</script>
Run Code Online (Sandbox Code Playgroud)
和
<a href="#" onclick="javascript:goFunction();">GO</a>
Run Code Online (Sandbox Code Playgroud)
当我点击我的链接时,我在错误日志中收到此错误:
Uncaught SecurityError: A history state object with URL 'http://www.google.ca/' cannot be created in a document with origin 'http://cowelllaserhair.com'.
Run Code Online (Sandbox Code Playgroud)
你可以在http://cowelllaserhair.com/test.html看到这个
我究竟做错了什么?
我需要参考一下吗?
谢谢,J