jquery 打开页面window.location和window.open的区别

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery 打开页面window.location和window.open的区别相关的知识,希望对你有一定的参考价值。

1.window.location是window对象的属性,而window.open是window对象的方法

window.location是你对当前浏览器窗口的URL地址对象的参考!

window.open是用来打开一个新窗口的函数!

2.window.open不一定是打开一个新窗口

只要有窗口的名称和window.open中第二个参数中的一样就会将这个窗口替换,用这个特性的话可以在iframe和frame中来代替location.href。

<iframe name="aa"></iframe>

<input type=button   onclick="window.open('1.htm','aa','')">和

<input type=button

onclick="self.frames['aa'].location.href='1.htm'">的效果一样

3.在给按钮、表格、单元格、下拉列表和DIV等做链接时一般都要用Javascript来完成,和做普通链接一样,可能我们需要让链接页面在当前窗口打开,也可能需要在新窗口打开,这时我们就可以使用下面两项之一来完成:

window.open 用来打开新窗口

window.location 用来替换当前页,也就是重新定位当前页

可以用以下来个实例来测试一下。

<input type="button" value="新窗口打开" onclick="window.open('http://www.google.com')">

<input type="button" value="当前页打开" onclick="window.location='http://www.google.com/'">

4.window.location或window.open如何指定target?这是一个经常遇到的问题,特别是在用frame框架的时候

解决办法:

window.location 改为 top.location 即可在顶部链接到指定页

window.open("你的网址","_top");

5.window.open 用来打开新窗口

window.location 用来替换当前页,也就是重新定位当前页

用户不能改变document.location(因为这是当前显示文档的位置)。

window.location本身也是一个对象。

但是,可以用window.location改变当前文档 (用其它文档取代当前文档),而document.location不是对象。

服务器重定向后有可能使document.url变动,但window.location.href指的永远是访问该网页时用的URL.

大多数情况下,document.location和location.href是相同的,但是,当存在服务器重定向时,document.location包含的是已经装载的URL,而location.href包含的则是原始请求的文档的URL.

6.window.open()是可以在一个网站上打开另外的一个网站的地址

而window.location()是只能在一个网站中打开本网站的网页

window.open()详解

<script type="text/javascript">
<!-- window.open ('page.html'); -->
</script>

因为着是一段javascripts代码,所以它们应该放在<SCRIPT LANGUAGE="javascript">标签和</script>之间。<!-- 和 -->是对一些版本低的浏览器起作用,在这些老浏览器中不会将标签中的代码作为文本显示出来。

要养成这个好习惯啊。

window.open ('page.html') 用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。用单引号和双引号都可以,只是不要混用。这一段代码可以加入HTML的任意位置,<head>和</head>之间可以,<body>间</body>也可以,越前越早执行,尤其是页面代码长,又想使页面早点弹出就尽量往前放。

经过设置后的弹出窗口

下面再说一说弹出窗口的设置。只要再往上面的代码中加一点东西就可以了。 我们来定制这个弹出的窗口的外观,尺寸大小,弹出的位置以适应该页面的具体情况。

<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') //这句要写成一行
-->
</SCRIPT>

参数解释:

window.open 弹出新窗口的命令;

'page.html' 弹出窗口的文件名;

'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;

height=100 窗口高度;

width=400 窗口宽度;

top=0 窗口距离屏幕上方的象素值;

left=0 窗口距离屏幕左侧的象素值;

toolbar=no 是否显示工具栏,yes为显示;

menubar,scrollbars 表示菜单栏和滚动栏。

resizable=no 是否允许改变窗口大小,yes为允许;

location=no 是否显示地址栏,yes为允许;

status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;

</SCRIPT>

用函数控制弹出窗口:

下面是一个完整的代码。

<html>
<head>
<script LANGUAGE="JavaScript">
<!--
function openwin() 
window.open ("page.html", "newwindow", "height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //写成一行

//-->
</script>
</head>
<body onload="openwin()">
任意的页面内容...
</body>
</html>

这里定义了一个函数openwin(),函数内容就是打开一个窗口。在调用它之前没有任何用途。怎么调用呢?

方法一:<body onload="openwin()"> 浏览器读页面时弹出窗口;

方法二:<body onunload="openwin()"> 浏览器离开页面时弹出窗口;

方法三:用一个连接调用:

<a href="#" onclick="openwin()">打开一个窗口</a>

注意:使用的“#”是虚连接。

方法四:用一个按钮调用:

<input type="button" onclick="openwin()" value="打开窗口">

同时弹出两个窗口

对源代码稍微改动一下:

<script LANGUAGE="JavaScript">
<!--
function openwin() 
window.open ("page.html", "newwindow", "height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=n o, status=no")//写成一行
window.open ("page2.html", "newwindow2", "height=100, width=100, top=1 00, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, loca tion=no, status=no")//写成一行

//-->
</script>

为避免弹出的2个窗口覆盖,用top和left控制一下弹出的位置不要相互覆盖即可 。最后用上面说过的四种方法调用即可。

注意:2个窗口的name(newwindows和newwindow2)不要相同,或者干脆全部为空。

【主窗口打开文件1.htm,同时弹出小窗口page.html】

如下代码加入主窗口<head>区:

<script language="javascript">
<!--
function openwin() 
window.open("page.html","","width=200,height=200")

//-->
</script>

加入<body>区:

<a href="1.htm" onclick="openwin()">open</a>即可。

【弹出的窗口之定时关闭控制】

下面我们再对弹出的窗口进行一些控制,效果就更好了。如果我们再将一小段 代码加入弹出的页面(注意是加入page.html的HTML中,可不是主页面中,否则 ...),让它10秒后自动关闭是不是更酷了?

首先,将如下代码加入page.html文件的<head>区:

<script language="JavaScript">
function closeit()

setTimeout("self.close()",10000) //毫秒

</script>

然后,再用<body onload="closeit()"> 这一句话代替page.html中原有的<BODY>这一句就可以了。(这一句话千万不要忘记写啊!这一句的作用是调用关闭窗 口的代码,10秒钟后就自行关闭该窗口。)

【在弹出窗口中加上一个关闭按钮】

<script>
<INPUT TYPE='BUTTON' VALUE='关闭' )
openwin()
document.cookie="popped=yes"


</script>

然后,用<body onload="loadpopup()">(注意不是openwin而是loadpop啊!)替换主页面中原有的<BODY>这一句即可。你可以试着刷新一下这个页面或重新进 入该页面,窗口再也不会弹出了。

注意:

1.window.location.Reload()和window.location.href=window.location.href;都是刷新当前页面。self.location.reload();   //也是刷新本页的意思;

2.用window.open()打开新页面,但是用window.location.href="" 却是在原窗口打开的.

有时浏览器会一些安全设置window.open肯定被屏蔽。例如避免弹出广告窗口。

参考技术A 1.window.location是window对象的属性,而window.open是window对象的方法
window.location是对当前浏览器窗口的URL地址对象的参考!
window.open是用来打开一个新窗口的函数!
2.window.open不一定是打开一个新窗口!!!!!!!!
只要有窗口的名称和window.open中第二个参数中的一样就会将这个窗口替换,用这个特性的话可以在iframe和frame中来代替location.href。
如<iframe name="aa"></iframe>
<input type=button onclick="window.open('1.htm','aa','')">和
<input type=button
onclick="self.frames['aa'].location.href='1.htm'">的效果一样
参考技术B window.location一般是当前的页面跳转,window.open是新开tab页签打开,不会影响当前的页面。

JavaScript实现页面重载 - 535种方式

location = location

... and a 534 other ways to reload the page with JavaScript

  1. location = location
  2. location = location.href
  3. location = window.location
  4. location = self.location
  5. location = window.location.href
  6. location = self.location.href
  7. location = location[‘href‘]
  8. location = window[‘location‘]
  9. location = window[‘location‘].href
  10. location = window[‘location‘][‘href‘]
  11. location = window.location[‘href‘]
  12. location = self[‘location‘]
  13. location = self[‘location‘].href
  14. location = self[‘location‘][‘href‘]
  15. location = self.location[‘href‘]
  16. location.assign(location)
  17. location.replace(location)
  18. window.location.assign(location)
  19. window.location.replace(location)
  20. self.location.assign(location)
  21. self.location.replace(location)
  22. location[‘assign‘](location)
  23. location[‘replace‘](location)
  24. window.location[‘assign‘](location)
  25. window.location[‘replace‘](location)
  26. window[‘location‘].assign(location)
  27. window[‘location‘].replace(location)
  28. window[‘location‘][‘assign‘](location)
  29. window[‘location‘][‘replace‘](location)
  30. self.location[‘assign‘](location)
  31. self.location[‘replace‘](location)
  32. self[‘location‘].assign(location)
  33. self[‘location‘].replace(location)
  34. self[‘location‘][‘assign‘](location)
  35. self[‘location‘][‘replace‘](location)
  36. location.href = location
  37. location.href = location.href
  38. location.href = window.location
  39. location.href = self.location
  40. location.href = window.location.href
  41. location.href = self.location.href
  42. location.href = location[‘href‘]
  43. location.href = window[‘location‘]
  44. location.href = window[‘location‘].href
  45. location.href = window[‘location‘][‘href‘]
  46. location.href = window.location[‘href‘]
  47. location.href = self[‘location‘]
  48. location.href = self[‘location‘].href
  49. location.href = self[‘location‘][‘href‘]
  50. location.href = self.location[‘href‘]
  51. location.assign(location.href)
  52. location.replace(location.href)
  53. window.location.assign(location.href)
  54. window.location.replace(location.href)
  55. self.location.assign(location.href)
  56. self.location.replace(location.href)
  57. location[‘assign‘](location.href)
  58. location[‘replace‘](location.href)
  59. window.location[‘assign‘](location.href)
  60. window.location[‘replace‘](location.href)
  61. window[‘location‘].assign(location.href)
  62. window[‘location‘].replace(location.href)
  63. window[‘location‘][‘assign‘](location.href)
  64. window[‘location‘][‘replace‘](location.href)
  65. self.location[‘assign‘](location.href)
  66. self.location[‘replace‘](location.href)
  67. self[‘location‘].assign(location.href)
  68. self[‘location‘].replace(location.href)
  69. self[‘location‘][‘assign‘](location.href)
  70. self[‘location‘][‘replace‘](location.href)
  71. window.location = location
  72. window.location = location.href
  73. window.location = window.location
  74. window.location = self.location
  75. window.location = window.location.href
  76. window.location = self.location.href
  77. window.location = location[‘href‘]
  78. window.location = window[‘location‘]
  79. window.location = window[‘location‘].href
  80. window.location = window[‘location‘][‘href‘]
  81. window.location = window.location[‘href‘]
  82. window.location = self[‘location‘]
  83. window.location = self[‘location‘].href
  84. window.location = self[‘location‘][‘href‘]
  85. window.location = self.location[‘href‘]
  86. location.assign(window.location)
  87. location.replace(window.location)
  88. window.location.assign(window.location)
  89. window.location.replace(window.location)
  90. self.location.assign(window.location)
  91. self.location.replace(window.location)
  92. location[‘assign‘](window.location)
  93. location[‘replace‘](window.location)
  94. window.location[‘assign‘](window.location)
  95. window.location[‘replace‘](window.location)
  96. window[‘location‘].assign(window.location)
  97. window[‘location‘].replace(window.location)
  98. window[‘location‘][‘assign‘](window.location)
  99. window[‘location‘][‘replace‘](window.location)
  100. self.location[‘assign‘](window.location)
  101. self.location[‘replace‘](window.location)
  102. self[‘location‘].assign(window.location)
  103. self[‘location‘].replace(window.location)
  104. self[‘location‘][‘assign‘](window.location)
  105. self[‘location‘][‘replace‘](window.location)
  106. self.location = location
  107. self.location = location.href
  108. self.location = window.location
  109. self.location = self.location
  110. self.location = window.location.href
  111. self.location = self.location.href
  112. self.location = location[‘href‘]
  113. self.location = window[‘location‘]
  114. self.location = window[‘location‘].href
  115. self.location = window[‘location‘][‘href‘]
  116. self.location = window.location[‘href‘]
  117. self.location = self[‘location‘]
  118. self.location = self[‘location‘].href
  119. self.location = self[‘location‘][‘href‘]
  120. self.location = self.location[‘href‘]
  121. location.assign(self.location)
  122. location.replace(self.location)
  123. window.location.assign(self.location)
  124. window.location.replace(self.location)
  125. self.location.assign(self.location)
  126. self.location.replace(self.location)
  127. location[‘assign‘](self.location)
  128. location[‘replace‘](self.location)
  129. window.location[‘assign‘](self.location)
  130. window.location[‘replace‘](self.location)
  131. window[‘location‘].assign(self.location)
  132. window[‘location‘].replace(self.location)
  133. window[‘location‘][‘assign‘](self.location)
  134. window[‘location‘][‘replace‘](self.location)
  135. self.location[‘assign‘](self.location)
  136. self.location[‘replace‘](self.location)
  137. self[‘location‘].assign(self.location)
  138. self[‘location‘].replace(self.location)
  139. self[‘location‘][‘assign‘](self.location)
  140. self[‘location‘][‘replace‘](self.location)
  141. window.location.href = location
  142. window.location.href = location.href
  143. window.location.href = window.location
  144. window.location.href = self.location
  145. window.location.href = window.location.href
  146. window.location.href = self.location.href
  147. window.location.href = location[‘href‘]
  148. window.location.href = window[‘location‘]
  149. window.location.href = window[‘location‘].href
  150. window.location.href = window[‘location‘][‘href‘]
  151. window.location.href = window.location[‘href‘]
  152. window.location.href = self[‘location‘]
  153. window.location.href = self[‘location‘].href
  154. window.location.href = self[‘location‘][‘href‘]
  155. window.location.href = self.location[‘href‘]
  156. location.assign(window.location.href)
  157. location.replace(window.location.href)
  158. window.location.assign(window.location.href)
  159. window.location.replace(window.location.href)
  160. self.location.assign(window.location.href)
  161. self.location.replace(window.location.href)
  162. location[‘assign‘](window.location.href)
  163. location[‘replace‘](window.location.href)
  164. window.location[‘assign‘](window.location.href)
  165. window.location[‘replace‘](window.location.href)
  166. window[‘location‘].assign(window.location.href)
  167. window[‘location‘].replace(window.location.href)
  168. window[‘location‘][‘assign‘](window.location.href)
  169. window[‘location‘][‘replace‘](window.location.href)
  170. self.location[‘assign‘](window.location.href)
  171. self.location[‘replace‘](window.location.href)
  172. self[‘location‘].assign(window.location.href)
  173. self[‘location‘].replace(window.location.href)
  174. self[‘location‘][‘assign‘](window.location.href)
  175. self[‘location‘][‘replace‘](window.location.href)
  176. self.location.href = location
  177. self.location.href = location.href
  178. self.location.href = window.location
  179. self.location.href = self.location
  180. self.location.href = window.location.href
  181. self.location.href = self.location.href
  182. self.location.href = location[‘href‘]
  183. self.location.href = window[‘location‘]
  184. self.location.href = window[‘location‘].href
  185. self.location.href = window[‘location‘][‘href‘]
  186. self.location.href = window.location[‘href‘]
  187. self.location.href = self[‘location‘]
  188. self.location.href = self[‘location‘].href
  189. self.location.href = self[‘location‘][‘href‘]
  190. self.location.href = self.location[‘href‘]
  191. location.assign(self.location.href)
  192. location.replace(self.location.href)
  193. window.location.assign(self.location.href)
  194. window.location.replace(self.location.href)
  195. self.location.assign(self.location.href)
  196. self.location.replace(self.location.href)
  197. location[‘assign‘](self.location.href)
  198. location[‘replace‘](self.location.href)
  199. window.location[‘assign‘](self.location.href)
  200. window.location[‘replace‘](self.location.href)
  201. window[‘location‘].assign(self.location.href)
  202. window[‘location‘].replace(self.location.href)
  203. window[‘location‘][‘assign‘](self.location.href)
  204. window[‘location‘][‘replace‘](self.location.href)
  205. self.location[‘assign‘](self.location.href)
  206. self.location[‘replace‘](self.location.href)
  207. self[‘location‘].assign(self.location.href)
  208. self[‘location‘].replace(self.location.href)
  209. self[‘location‘][‘assign‘](self.location.href)
  210. self[‘location‘][‘replace‘](self.location.href)
  211. location[‘href‘] = location
  212. location[‘href‘] = location.href
  213. location[‘href‘] = window.location
  214. location[‘href‘] = self.location
  215. location[‘href‘] = window.location.href
  216. location[‘href‘] = self.location.href
  217. location[‘href‘] = location[‘href‘]
  218. location[‘href‘] = window[‘location‘]
  219. location[‘href‘] = window[‘location‘].href
  220. location[‘href‘] = window[‘location‘][‘href‘]
  221. location[‘href‘] = window.location[‘href‘]
  222. location[‘href‘] = self[‘location‘]
  223. location[‘href‘] = self[‘location‘].href
  224. location[‘href‘] = self[‘location‘][‘href‘]
  225. location[‘href‘] = self.location[‘href‘]
  226. location.assign(location[‘href‘])
  227. location.replace(location[‘href‘])
  228. window.location.assign(location[‘href‘])
  229. window.location.replace(location[‘href‘])
  230. self.location.assign(location[‘href‘])
  231. self.location.replace(location[‘href‘])
  232. location[‘assign‘](location[‘href‘])
  233. location[‘replace‘](location[‘href‘])
  234. window.location[‘assign‘](location[‘href‘])
  235. window.location[‘replace‘](location[‘href‘])
  236. window[‘location‘].assign(location[‘href‘])
  237. window[‘location‘].replace(location[‘href‘])
  238. window[‘location‘][‘assign‘](location[‘href‘])
  239. window[‘location‘][‘replace‘](location[‘href‘])
  240. self.location[‘assign‘](location[‘href‘])
  241. self.location[‘replace‘](location[‘href‘])
  242. self[‘location‘].assign(location[‘href‘])
  243. self[‘location‘].replace(location[‘href‘])
  244. self[‘location‘][‘assign‘](location[‘href‘])
  245. self[‘location‘][‘replace‘](location[‘href‘])
  246. window[‘location‘] = location
  247. window[‘location‘] = location.href
  248. window[‘location‘] = window.location
  249. window[‘location‘] = self.location
  250. window[‘location‘] = window.location.href
  251. window[‘location‘] = self.location.href
  252. window[‘location‘] = location[‘href‘]
  253. window[‘location‘] = window[‘location‘]
  254. window[‘location‘] = window[‘location‘].href
  255. window[‘location‘] = window[‘location‘][‘href‘]
  256. window[‘location‘] = window.location[‘href‘]
  257. window[‘location‘] = self[‘location‘]
  258. window[‘location‘] = self[‘location‘].href
  259. window[‘location‘] = self[‘location‘][‘href‘]
  260. window[‘location‘] = self.location[‘href‘]
  261. location.assign(window[‘location‘])
  262. location.replace(window[‘location‘])
  263. window.location.assign(window[‘location‘])
  264. window.location.replace(window[‘location‘])
  265. self.location.assign(window[‘location‘])
  266. self.location.replace(window[‘location‘])
  267. location[‘assign‘](window[‘location‘])
  268. location[‘replace‘](window[‘location‘])
  269. window.location[‘assign‘](window[‘location‘])
  270. window.location[‘replace‘](window[‘location‘])
  271. window[‘location‘].assign(window[‘location‘])
  272. window[‘location‘].replace(window[‘location‘])
  273. window[‘location‘][‘assign‘](window[‘location‘])
  274. window[‘location‘][‘replace‘](window[‘location‘])
  275. self.location[‘assign‘](window[‘location‘])
  276. self.location[‘replace‘](window[‘location‘])
  277. self[‘location‘].assign(window[‘location‘])
  278. self[‘location‘].replace(window[‘location‘])
  279. self[‘location‘][‘assign‘](window[‘location‘])
  280. self[‘location‘][‘replace‘](window[‘location‘])
  281. window[‘location‘].href = location
  282. window[‘location‘].href = location.href
  283. window[‘location‘].href = window.location
  284. window[‘location‘].href = self.location
  285. window[‘location‘].href = window.location.href
  286. window[‘location‘].href = self.location.href
  287. window[‘location‘].href = location[‘href‘]
  288. window[‘location‘].href = window[‘location‘]
  289. window[‘location‘].href = window[‘location‘].href
  290. window[‘location‘].href = window[‘location‘][‘href‘]
  291. window[‘location‘].href = window.location[‘href‘]
  292. window[‘location‘].href = self[‘location‘]
  293. window[‘location‘].href = self[‘location‘].href
  294. window[‘location‘].href = self[‘location‘][‘href‘]
  295. window[‘location‘].href = self.location[‘href‘]
  296. location.assign(window[‘location‘].href)
  297. location.replace(window[‘location‘].href)
  298. window.location.assign(window[‘location‘].href)
  299. window.location.replace(window[‘location‘].href)
  300. self.location.assign(window[‘location‘].href)
  301. self.location.replace(window[‘location‘].href)
  302. location[‘assign‘](window[‘location‘].href)
  303. location[‘replace‘](window[‘location‘].href)
  304. window.location[‘assign‘](window[‘location‘].href)
  305. window.location[‘replace‘](window[‘location‘].href)
  306. window[‘location‘].assign(window[‘location‘].href)
  307. window[‘location‘].replace(window[‘location‘].href)
  308. window[‘location‘][‘assign‘](window[‘location‘].href)
  309. window[‘location‘][‘replace‘](window[‘location‘].href)
  310. self.location[‘assign‘](window[‘location‘].href)
  311. self.location[‘replace‘](window[‘location‘].href)
  312. self[‘location‘].assign(window[‘location‘].href)
  313. self[‘location‘].replace(window[‘location‘].href)
  314. self[‘location‘][‘assign‘](window[‘location‘].href)
  315. self[‘location‘][‘replace‘](window[‘location‘].href)
  316. window[‘location‘][‘href‘] = location
  317. window[‘location‘][‘href‘] = location.href
  318. window[‘location‘][‘href‘] = window.location
  319. window[‘location‘][‘href‘] = self.location
  320. window[‘location‘][‘href‘] = window.location.href
  321. window[‘location‘][‘href‘] = self.location.href
  322. window[‘location‘][‘href‘] = location[‘href‘]
  323. window[‘location‘][‘href‘] = window[‘location‘]
  324. window[‘location‘][‘href‘] = window[‘location‘].href
  325. window[‘location‘][‘href‘] = window[‘location‘][‘href‘]
  326. window[‘location‘][‘href‘] = window.location[‘href‘]
  327. window[‘location‘][‘href‘] = self[‘location‘]
  328. window[‘location‘][‘href‘] = self[‘location‘].href
  329. window[‘location‘][‘href‘] = self[‘location‘][‘href‘]
  330. window[‘location‘][‘href‘] = self.location[‘href‘]
  331. location.assign(window[‘location‘][‘href‘])
  332. location.replace(window[‘location‘][‘href‘])
  333. window.location.assign(window[‘location‘][‘href‘])
  334. window.location.replace(window[‘location‘][‘href‘])
  335. self.location.assign(window[‘location‘][‘href‘])
  336. self.location.replace(window[‘location‘][‘href‘])
  337. location[‘assign‘](window[‘location‘][‘href‘])
  338. location[‘replace‘](window[‘location‘][‘href‘])
  339. window.location[‘assign‘](window[‘location‘][‘href‘])
  340. window.location[‘replace‘](window[‘location‘][‘href‘])
  341. window[‘location‘].assign(window[‘location‘][‘href‘])
  342. window[‘location‘].replace(window[‘location‘][‘href‘])
  343. window[‘location‘][‘assign‘](window[‘location‘][‘href‘])
  344. window[‘location‘][‘replace‘](window[‘location‘][‘href‘])
  345. self.location[‘assign‘](window[‘location‘][‘href‘])
  346. self.location[‘replace‘](window[‘location‘][‘href‘])
  347. self[‘location‘].assign(window[‘location‘][‘href‘])
  348. self[‘location‘].replace(window[‘location‘][‘href‘])
  349. self[‘location‘][‘assign‘](window[‘location‘][‘href‘])
  350. self[‘location‘][‘replace‘](window[‘location‘][‘href‘])
  351. window.location[‘href‘] = location
  352. window.location[‘href‘] = location.href
  353. window.location[‘href‘] = window.location
  354. window.location[‘href‘] = self.location
  355. window.location[‘href‘] = window.location.href
  356. window.location[‘href‘] = self.location.href
  357. window.location[‘href‘] = location[‘href‘]
  358. window.location[‘href‘] = window[‘location‘]
  359. window.location[‘href‘] = window[‘location‘].href
  360. window.location[‘href‘] = window[‘location‘][‘href‘]
  361. window.location[‘href‘] = window.location[‘href‘]
  362. window.location[‘href‘] = self[‘location‘]
  363. window.location[‘href‘] = self[‘location‘].href
  364. window.location[‘href‘] = self[‘location‘][‘href‘]
  365. window.location[‘href‘] = self.location[‘href‘]
  366. location.assign(window.location[‘href‘])
  367. location.replace(window.location[‘href‘])
  368. window.location.assign(window.location[‘href‘])
  369. window.location.replace(window.location[‘href‘])
  370. self.location.assign(window.location[‘href‘])
  371. self.location.replace(window.location[‘href‘])
  372. location[‘assign‘](window.location[‘href‘])
  373. location[‘replace‘](window.location[‘href‘])
  374. window.location[‘assign‘](window.location[‘href‘])
  375. window.location[‘replace‘](window.location[‘href‘])
  376. window[‘location‘].assign(window.location[‘href‘])
  377. window[‘location‘].replace(window.location[‘href‘])
  378. window[‘location‘][‘assign‘](window.location[‘href‘])
  379. window[‘location‘][‘replace‘](window.location[‘href‘])
  380. self.location[‘assign‘](window.location[‘href‘])
  381. self.location[‘replace‘](window.location[‘href‘])
  382. self[‘location‘].assign(window.location[‘href‘])
  383. self[‘location‘].replace(window.location[‘href‘])
  384. self[‘location‘][‘assign‘](window.location[‘href‘])
  385. self[‘location‘][‘replace‘](window.location[‘href‘])
  386. self[‘location‘] = location
  387. self[‘location‘] = location.href
  388. self[‘location‘] = window.location
  389. self[‘location‘] = self.location
  390. self[‘location‘] = window.location.href
  391. self[‘location‘] = self.location.href
  392. self[‘location‘] = location[‘href‘]
  393. self[‘location‘] = window[‘location‘]
  394. self[‘location‘] = window[‘location‘].href
  395. self[‘location‘] = window[‘location‘][‘href‘]
  396. self[‘location‘] = window.location[‘href‘]
  397. self[‘location‘] = self[‘location‘]
  398. self[‘location‘] = self[‘location‘].href
  399. self[‘location‘] = self[‘location‘][‘href‘]
  400. self[‘location‘] = self.location[‘href‘]
  401. location.assign(self[‘location‘])
  402. location.replace(self[‘location‘])
  403. window.location.assign(self[‘location‘])
  404. window.location.replace(self[‘location‘])
  405. self.location.assign(self[‘location‘])
  406. self.location.replace(self[‘location‘])
  407. location[‘assign‘](self[‘location‘])
  408. location[‘replace‘](self[‘location‘])
  409. window.location[‘assign‘](self[‘location‘])
  410. window.location[‘replace‘](self[‘location‘])
  411. window[‘location‘].assign(self[‘location‘])
  412. window[‘location‘].replace(self[‘location‘])
  413. window[‘location‘][‘assign‘](self[‘location‘])
  414. window[‘location‘][‘replace‘](self[‘location‘])
  415. self.location[‘assign‘](self[‘location‘])
  416. self.location[‘replace‘](self[‘location‘])
  417. self[‘location‘].assign(self[‘location‘])
  418. self[‘location‘].replace(self[‘location‘])
  419. self[‘location‘][‘assign‘](self[‘location‘])
  420. self[‘location‘][‘replace‘](self[‘location‘])
  421. self[‘location‘].href = location
  422. self[‘location‘].href = location.href
  423. self[‘location‘].href = window.location
  424. self[‘location‘].href = self.location
  425. self[‘location‘].href = window.location.href
  426. self[‘location‘].href = self.location.href
  427. self[‘location‘].href = location[‘href‘]
  428. self[‘location‘].href = window[‘location‘]
  429. self[‘location‘].href = window[‘location‘].href
  430. self[‘location‘].href = window[‘location‘][‘href‘]
  431. self[‘location‘].href = window.location[‘href‘]
  432. self[‘location‘].href = self[‘location‘]
  433. self[‘location‘].href = self[‘location‘].href
  434. self[‘location‘].href = self[‘location‘][‘href‘]
  435. self[‘location‘].href = self.location[‘href‘]
  436. location.assign(self[‘location‘].href)
  437. location.replace(self[‘location‘].href)
  438. window.location.assign(self[‘location‘].href)
  439. window.location.replace(self[‘location‘].href)
  440. self.location.assign(self[‘location‘].href)
  441. self.location.replace(self[‘location‘].href)
  442. location[‘assign‘](self[‘location‘].href)
  443. location[‘replace‘](self[‘location‘].href)
  444. window.location[‘assign‘](self[‘location‘].href)
  445. window.location[‘replace‘](self[‘location‘].href)
  446. window[‘location‘].assign(self[‘location‘].href)
  447. window[‘location‘].replace(self[‘location‘].href)
  448. window[‘location‘][‘assign‘](self[‘location‘].href)
  449. window[‘location‘][‘replace‘](self[‘location‘].href)
  450. self.location[‘assign‘](self[‘location‘].href)
  451. self.location[‘replace‘](self[‘location‘].href)
  452. self[‘location‘].assign(self[‘location‘].href)
  453. self[‘location‘].replace(self[‘location‘].href)
  454. self[‘location‘][‘assign‘](self[‘location‘].href)
  455. self[‘location‘][‘replace‘](self[‘location‘].href)
  456. self[‘location‘][‘href‘] = location
  457. self[‘location‘][‘href‘] = location.href
  458. self[‘location‘][‘href‘] = window.location
  459. self[‘location‘][‘href‘] = self.location
  460. self[‘location‘][‘href‘] = window.location.href
  461. self[‘location‘][‘href‘] = self.location.href
  462. self[‘location‘][‘href‘] = location[‘href‘]
  463. self[‘location‘][‘href‘] = window[‘location‘]
  464. self[‘location‘][‘href‘] = window[‘location‘].href
  465. self[‘location‘][‘href‘] = window[‘location‘][‘href‘]
  466. self[‘location‘][‘href‘] = window.location[‘href‘]
  467. self[‘location‘][‘href‘] = self[‘location‘]
  468. self[‘location‘][‘href‘] = self[‘location‘].href
  469. self[‘location‘][‘href‘] = self[‘location‘][‘href‘]
  470. self[‘location‘][‘href‘] = self.location[‘href‘]
  471. location.assign(self[‘location‘][‘href‘])
  472. location.replace(self[‘location‘][‘href‘])
  473. window.location.assign(self[‘location‘][‘href‘])
  474. window.location.replace(self[‘location‘][‘href‘])
  475. self.location.assign(self[‘location‘][‘href‘])
  476. self.location.replace(self[‘location‘][‘href‘])
  477. location[‘assign‘](self[‘location‘][‘href‘])
  478. location[‘replace‘](self[‘location‘][‘href‘])
  479. window.location[‘assign‘](self[‘location‘][‘href‘])
  480. window.location[‘replace‘](self[‘location‘][‘href‘])
  481. window[‘location‘].assign(self[‘location‘][‘href‘])
  482. window[‘location‘].replace(self[‘location‘][‘href‘])
  483. window[‘location‘][‘assign‘](self[‘location‘][‘href‘])
  484. window[‘location‘][‘replace‘](self[‘location‘][‘href‘])
  485. self.location[‘assign‘](self[‘location‘][‘href‘])
  486. self.location[‘replace‘](self[‘location‘][‘href‘])
  487. self[‘location‘].assign(self[‘location‘][‘href‘])
  488. self[‘location‘].replace(self[‘location‘][‘href‘])
  489. self[‘location‘][‘assign‘](self[‘location‘][‘href‘])
  490. self[‘location‘][‘replace‘](self[‘location‘][‘href‘])
  491. self.location[‘href‘] = location
  492. self.location[‘href‘] = location.href
  493. self.location[‘href‘] = window.location
  494. self.location[‘href‘] = self.location
  495. self.location[‘href‘] = window.location.href
  496. self.location[‘href‘] = self.location.href
  497. self.location[‘href‘] = location[‘href‘]
  498. self.location[‘href‘] = window[‘location‘]
  499. self.location[‘href‘] = window[‘location‘].href
  500. self.location[‘href‘] = window[‘location‘][‘href‘]
  501. self.location[‘href‘] = window.location[‘href‘]
  502. self.location[‘href‘] = self[‘location‘]
  503. self.location[‘href‘] = self[‘location‘].href
  504. self.location[‘href‘] = self[‘location‘][‘href‘]
  505. self.location[‘href‘] = self.location[‘href‘]
  506. location.assign(self.location[‘href‘])
  507. location.replace(self.location[‘href‘])
  508. window.location.assign(self.location[‘href‘])
  509. window.location.replace(self.location[‘href‘])
  510. self.location.assign(self.location[‘href‘])
  511. self.location.replace(self.location[‘href‘])
  512. location[‘assign‘](self.location[‘href‘])
  513. location[‘replace‘](self.location[‘href‘])
  514. window.location[‘assign‘](self.location[‘href‘])
  515. window.location[‘replace‘](self.location[‘href‘])
  516. window[‘location‘].assign(self.location[‘href‘])
  517. window[‘location‘].replace(self.location[‘href‘])
  518. window[‘location‘][‘assign‘](self.location[‘href‘])
  519. window[‘location‘][‘replace‘](self.location[‘href‘])
  520. self.location[‘assign‘](self.location[‘href‘])
  521. self.location[‘replace‘](self.location[‘href‘])
  522. self[‘location‘].assign(self.location[‘href‘])
  523. self[‘location‘].replace(self.location[‘href‘])
  524. self[‘location‘][‘assign‘](self.location[‘href‘])
  525. self[‘location‘][‘replace‘](self.location[‘href‘])
  526. location.reload()
  527. location[‘reload‘]()
  528. window.location.reload()
  529. window[‘location‘].reload()
  530. window.location[‘reload‘]()
  531. window[‘location‘][‘reload‘]()
  532. self.location.reload()
  533. self[‘location‘].reload()
  534. self.location[‘reload‘]()
  535. self[‘location‘][‘reload‘]()

以上是关于jquery 打开页面window.location和window.open的区别的主要内容,如果未能解决你的问题,请参考以下文章

将目标添加到 window.location [重复]

页面重定向的几种方法

通过URL传参数,然后第二个页面需要获取参数

如何使用会话数组检查复选框

使用 JavaScript 检查链接变量

jquery如何让上一个页面打开指定页面