简体   繁体   English

使用命令关闭窗口并重新加载父页面后,如何在重新加载后自动弹出div?

[英]After closing a window with a command and reload the parent page, how can you make a div pop up automatically after the reload?

The flow is as this: 流程是这样的:

  1. User clicks register button, opens up a registration page using the window.open command. 用户单击注册按钮,使用window.open命令打开注册页面。

  2. User gives their details to the page and submits. 用户将其详细信息提供给页面并提交。

  3. Upon submit it sends the details to the database and then closes the popup window using 提交后,它将详细信息发送到数据库,然后使用关闭窗口

     onsubmit="refreshWelcome()" //used in the form function refreshWelcome() { //closes pages and reloads welcome page again. window.opener.location.reload(); window.close(); } 
  4. On Return to the parent, I'd like a message to popup saying Registration complete just before the login area. 在“返回父级”上,我想弹出一条消息,说“登录完成”恰好在登录区域之前。

I am unsure how #4 can be done and is it possible? 我不确定#4怎么做,有可能吗? Welcome_page has the button goes to - Registration page popup - Registration submits data using another php page regprocess. Welcome_page的按钮转到-注册页面弹出窗口-注册使用另一个php页面regprocess提交数据。

Did I clarify what im looking for or do you need more information? 我是否已明确说明我在寻找什么,或者您需要更多信息?

You can assign an event handler to the closing event fired by the window. 您可以将事件处理程序分配给窗口触发的关闭事件。

Let's say your window is opened like this: 假设您的窗口是这样打开的:

var registrationWindow = window.open(url);

You can then bind a callback to the onbeforeunload event, for example: 然后,您可以将回调绑定到onbeforeunload事件,例如:

registrationWindow.onbeforeunload = function(){
    /... your code here .../
}

Make sure that your opened window url is located on the same domain as your parent window, otherwise this won't work. 确保您打开的窗口网址与父窗口位于同一域中,否则将无法使用。

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

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