window.opener.location.reload() [英] window.opener.location.reload()

查看:211
本文介绍了window.opener.location.reload()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打开弹出窗口的页面,在窗口内,提交了一些数据库

信息并关闭窗口。然后使用window.opener.location.reload()刷新原始的

窗口。问题是,在重新加载

后,它会将您带到页面顶部。当我点击原始页面上的''刷新'

时,它会将我带回原始查看位置。

有没有办法在弹出窗口中复制此内容。


另外,当使用上面的X关闭弹出窗口

窗口时,有没有办法运行window.opener.location.reload()右手角?谢谢!


Darren

I have a page that opens a popup window and within the window, some databse
info is submitted and the window closes. It then refreshes the original
window using window.opener.location.reload(). The problem is that after the
reload, it brings you right to the top of the page. When I click ''refresh"
on the original page, it brings me back to the original viewing position.
Is there a way to duplicate this in from the popup window.

Also, is there a way to run window.opener.location.reload() when the popup
window is closed using the X in the upper right hand corner? Thanks!

Darren

推荐答案

我在Windows之间没有尝试过,但从理论上讲,你可以从主窗口捕获

document.body.scrollLeft和document.body.scrollTop(你需要的那个
真正需要的那个)值,重新加载并强制这些值

回到重装前的状态。


所以:

I haven''t tried it between windows, but theoretically, you could capture
the document.body.scrollLeft and document.body.scrollTop (the one you
really need) values from the main window, reload and force those values
back to what they were before the reload.

So:


pageoffset = document.body.scrollTop;

window.opener.location.reload();

window.opener.document.body.scrollTop =
pageoffset = document.body.scrollTop;
window.opener.location.reload();
window.opener.document.body.scrollTop =


pageoffset;


对于第二个问题,从技术上讲,window.onunload事件应该是

为您提供所需的事件句柄。然而,浏览器的实现以及为了避免popunders的积极设置已经让这个事件变得更加可靠,而不是像JS在这个丑陋的乌托邦世界那样可靠/>
滥用侵扰性广告。


--------------------------- ----------

J Wynia

Myriad Intellect,Inc。

获得保留的网络技术。
www.myriadintellect.com

- ------------------------------------


达伦写道:
pageoffset;

For your second question, technically the window.onunload event should
give you the event handle you need. However, browser implementations and
aggressive settings to avoid popunders have rendered this event much
less reliable than it might have been in a utopian world where JS wasn''t
abused for intrusive advertising.

-------------------------------------
J Wynia
Myriad Intellect, Inc.
"Web technology that earns its keep."
www.myriadintellect.com
-------------------------------------

Darren wrote:
我有一个页面打开一个弹出窗口,在窗口内,提交了一些数据库
信息,窗口关闭。然后使用window.opener.location.reload()刷新原始窗口。问题是在重新加载后,它会将您带到页面顶部。当我点击原始页面上的刷新页面时,它会将我带回原始查看位置。
有没有办法在弹出窗口中复制此内容。
另外,当使用右上角的X关闭弹出窗口时,有没有办法运行window.opener.location.reload()?谢谢!

Darren
I have a page that opens a popup window and within the window, some databse
info is submitted and the window closes. It then refreshes the original
window using window.opener.location.reload(). The problem is that after the
reload, it brings you right to the top of the page. When I click ''refresh"
on the original page, it brings me back to the original viewing position.
Is there a way to duplicate this in from the popup window.

Also, is there a way to run window.opener.location.reload() when the popup
window is closed using the X in the upper right hand corner? Thanks!

Darren



这篇关于window.opener.location.reload()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆