javascript popup window and reload

十年热恋 提交于 2019-12-12 01:51:42

问题


I have a slight variation on the window.opener.reload javascript.

Normally, if I want to reload a page after closing a pop-up window I use

   window.opener.reload(true)

But this time i want to load a different url into the opener window.

So i tried this:

  window.opener.href('url').reload(true);

But this isn't working. Any ideas on why it isn't working and how I can make it work??

Thanks jw


回答1:


Assign to location.href:

opener.location.href = "url";



回答2:


This might work (subject to same-origin policy restrictions):

window.opener.location = url;




回答3:


Try this instead:

window.opener.location.href = "somepage.htm";



回答4:


You dont need to reload page when set a new uri (second case) you must code directly:

opener.location.href = "url";


来源:https://stackoverflow.com/questions/7599382/javascript-popup-window-and-reload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!