Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么文件名会被地址栏中的JavaScript函数替换?_Javascript_Html_Browser_Web - Fatal编程技术网

为什么文件名会被地址栏中的JavaScript函数替换?

为什么文件名会被地址栏中的JavaScript函数替换?,javascript,html,browser,web,Javascript,Html,Browser,Web,本地html文件表示其路径为/path/to/file.html。在开始时有以下内容 <html> <head> <link rel="shortcut icon" href="logo.ico"/> <LINK href="1.css" rel="stylesheet" type="text/css" /> <script

本地html文件表示其路径为
/path/to/file.html
。在开始时有以下内容

<html>

 <head>

  <link rel="shortcut icon" href="logo.ico"/>
  <LINK href="1.css" rel="stylesheet" type="text/css" />
  <script src="1.js" type="text/javascript"> </script>

 </head>

<body class = "body_background">
.
.
.
这种情况发生在FireFox和Safari上,而不是Chrome上

Chrome
上,页面会正确显示

这个问题是给朋友的。
location
在一些JS实现中是保留字,如
document.location


请参阅:

@Diodeus这是一个函数!
location
不是一个保留的javascript对象/术语吗?它有自己的javascript实现,没有这个限制。它不是一个保留字。它是一个属性名,如
window.location
中所示。
if(window.addEventListener) {

  window.addEventListener('load', location, false);

  }
else if (window.attachEvent) window.attachEvent('onload', location);