admin管理员组文章数量:1427301
I am trying to use the following JavaScript to check if a popup page is still open.
The parent page (calling page to open popup) is open but this code continues to fail. I am calling it from an aspx popup page that has a masterpage inside another masterpage. So the click event that eventually calls this script is an Edit Link in a Gridview in a content Placeholder which is in the upper most master page content Placeholder, not sure if that has anything to do with it. The script fires but it does not see the parent page as open and not closed.
if (window.opener != null && !window.opener.closed) {
alert(window.opener);
var val = window.opener.parentFunc(a);
alert(a);
}
This is an IE only problem, Firefox can identify the window.opener
page. Tried multiple versions of IE all had issues, Firefox and Opera work though.
I actually used this alert statement....
alert(window.opener);
In IE returns Undefined.
In Firefox returned ObjectWindow.
I am trying to use the following JavaScript to check if a popup page is still open.
The parent page (calling page to open popup) is open but this code continues to fail. I am calling it from an aspx popup page that has a masterpage inside another masterpage. So the click event that eventually calls this script is an Edit Link in a Gridview in a content Placeholder which is in the upper most master page content Placeholder, not sure if that has anything to do with it. The script fires but it does not see the parent page as open and not closed.
if (window.opener != null && !window.opener.closed) {
alert(window.opener);
var val = window.opener.parentFunc(a);
alert(a);
}
This is an IE only problem, Firefox can identify the window.opener
page. Tried multiple versions of IE all had issues, Firefox and Opera work though.
I actually used this alert statement....
alert(window.opener);
In IE returns Undefined.
In Firefox returned ObjectWindow.
Share Improve this question edited Oct 4, 2011 at 13:11 Domenic 113k42 gold badges226 silver badges273 bronze badges asked Oct 4, 2011 at 12:56 htm11hhtm11h 1,7798 gold badges48 silver badges107 bronze badges 1- Java is different from Javascript. You need to fix your tag. – Freesnöw Commented Oct 4, 2011 at 13:04
3 Answers
Reset to default 0I believe this is a security restriction in IE. Take a look at this thread and see if it answers your problem:
http://social.msdn.microsoft./Forums/en/iewebdevelopment/thread/0c014e78-8d35-4df3-93da-7f6a30b4ed8b
I got this to work by sending the script from VB like this....
Dim BrowserSettings As String = "status=no,toolbar=no, scrollbars =yes,menubar=no,location=no,resizable=no," & "titlebar=no, addressbar=no, width=650 ,height=800"
Dim URL As String = "testNewPage.aspx"
Dim scriptText1 As String = ("<script>javascript: var w = window.open('" & URL & "','_blank','" & BrowserSettings & "'); </script>")
ScriptManager.RegisterStartupScript(Me, GetType(Page), "ClientScript1", scriptText1, False)here
This isn't exactly what I wanted, but it seems to be working except now the popup page is not on top. Need to figure that part out.
I have been trying to apply focus, doesn't seem to work. Also, tried a modaless popup, that works but I lose the reference to the open window then.
function getParentWindow(){
var father = window.opener;
if(father == undefined) {
father=window.dialogArguments
}
return father;
}
本文标签: internet explorerJavaScript issue in IE with windowopenerStack Overflow
版权声明:本文标题:internet explorer - JavaScript issue in IE with window.opener - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745496657a2660836.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论