简体   繁体   English

如何使用链接或按钮等关闭html页面?

[英]How close html page with link or button , etc?

Hy guys, i made a upload page, after the sucess of operation i would like to close the html page automatically or by a link or something. 大家好,我制作了一个上传页面,在操作成功后,我想自动或通过链接或其他方式关闭html页面。

window.close don't work in this case, 'cause is not a window pop up. window.close在这种情况下不起作用,因为不是弹出窗口。

Any ideas? 有任何想法吗?

Best regards, Valter Henrique. 最好的问候,Valter Henrique。

If window.close() won't work, you can't do anything else. 如果window.close()无法正常工作,则您无能为力。

Which is good, because I don't want sites closing my window. 这是很好的,因为我不希望网站关闭我的窗口。

You could try window.close() , and then immediately after it update the DOM with a message such as "This window may be closed." 您可以尝试window.close() ,然后在它使用诸如“此窗口可能已关闭”之类的消息更新DOM之后立即进行尝试。 That way, if you ever can close the window (perhaps some browsers may let you), you will cover both bases. 这样,如果您可以关闭窗口(也许某些浏览器可能允许您关闭),则将涵盖这两个方面。

There is no way to do this and that's a good thing. 没有办法做到这一点,这是一件好事。 It may confuse the user. 这可能会使用户感到困惑。 Instead, show a message telling the user that they may close the window now. 而是显示一条消息,告诉用户他们现在可以关闭窗口。

I see you want to close the greybox from within the child page. 我看到您想从子页面中关闭灰框。 Try 尝试

top.GB_hide();

some kind of hack here...but may not work in all browsers 此处存在某种黑客行为...但可能无法在所有浏览器中使用

window.opener=null;
window.open('','_self');
window.close();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM