我有一个页面是这样写的
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>无标题文档</title> <script> function test() { alert("testing."); } </script> </head> <body onLoad="test();"> </body> </html>
在用chrome调用时发现在alert窗口出来的时候有一个javascript错误
Uncaught TypeError: Cannot read property 'hasPort' of undefined
因为这个错误导致我后面的函数无法正常解析。
我想请问一下,这是chrome的错误还是我的函数错误?有没有办法解决?
我的chrome是16 beta和17 dev版的。
PHPz2017-04-10 12:43:37
可以运行
code如下:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script type="text/javascript"> function test(){ alert("ok?!"); } </script> </head> <body onload="test();"> </body> </html>
怪我咯2017-04-10 12:43:37
如果你的页面是 background 页面,那这样应该是弹不出来的,如果是 popup 或者是 options 页面 ,应该没有什么问题。
如果依然有问题,可以向 chrome 提交 issue.