< body > < script type = text / javascript > this.focus(); var objWin = window.self; objWin.open('','_ self',''); objWin.close(); openFFPromotionPopup(MainPage.aspx,EAZY) < / script > < / body >
如果用户点击同一链接打开MainPage.aspx页面,这将成功。 我试图修改代码使得它将在Page Load事件上执行,但windowObjectReference将始终为null,因为它将在每次加载页面时执行,然后它将清除所有用户会话并且用户的数据条目将丢失。 问题: 如果相同的窗口已经打开而没有刷新它如何弹出窗口它会保留用户的数据条目? (在PAGE LOAD上验证不是通过按钮点击) ************************ ************ 更新 ************************************* ****** 为了更清楚,如何使用WINDOWS NAME(EAZY)检查已在浏览器中打开,以便用户点击任何链接(可能来自他们的书签或电子邮件),现有的EAZY会弹出而不刷新?
解决方案这个答案的反向过程。 用于打开许多弹出窗口的javascript [ ^ ]
Hye, Below is the scenario: 1. User clicks on a link (MainPage.aspx) , then a windows popup. After login -> he/she does some data entry in the system application. 2. Before finishing his/her transaction, an email come out and user clicks the link provided in the email which will be redirected to MainPage.aspx. Problem: I already implemented some code which is :
<script type="text/javascript"> var windowObjectReference = null; // global variable function openFFPromotionPopup(url, name) { var height = screen.availHeight; var width = screen.availWidth; var left = 0; var top = 0; var args = "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",toolbars=yes,scrollbars=no,status=no,resizable=no"; if (windowObjectReference == null || windowObjectReference.closed) /* if the pointer to the window object in memory does not exist or if such pointer exists but the window was closed */ { windowObjectReference = window.open(url, "EAZY", args); /* then create it. The new window will be created and will be brought on top of any other window. */ } else { windowObjectReference.focus(); /* else the window reference must exist and the window is not closed; therefore, we can bring it back on top of any other window with the focus() method. There would be no need to re-create the window or to reload the referenced resource. */ }; } </script><body> <script type="text/javascript"> this.focus(); var objWin = window.self; objWin.open('', '_self', ''); objWin.close(); openFFPromotionPopup("MainPage.aspx", "EAZY") </script> </body>
This will be successful if user clicks at the same link to open the MainPage.aspx page. I've tried to modify the code so that it will execute on Page Load event, but windowObjectReference will always be null as it will be executed each time page loads, then it will clear all user session and the user's data entry will lost. Question: How to popup the windows if the same windows has already been opened WITHOUT REFRESHING IT and it will keep the user's data entry? (validation on PAGE LOAD not by button click) ************************************ UPDATED ******************************************* To be more clearly, how can i check using WINDOWS NAME (which is EAZY) already been opened in the browser so if user click from any links (maybe from their bookmarks or email), the exisiting EAZY will popup and not refreshing?
解决方案 Reverse process of this answer. javascript for open many popup window[^]更多推荐
防止在页面加载时打开两次相同的窗口
发布评论