Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

java script error in internet explorer

when I hit this code in IE

<input type="submit" name="btnCancel" value="Cancel" onclick="javascript:window.opener.location.reload();self.close();" id="btnCancel" />

I get the error:

Microsoft JScript runtime error: 'window.opener.location' is null or not an object

THIS WORKS FINE IN CHROME WHERE I HAVE BEEN TESTING IT ALL ALONG
0
vbnetcoder
Asked:
vbnetcoder
  • 5
  • 3
  • 2
  • +2
1 Solution
 
janvanderwijkCommented:
Maby IE does't like that because the parent window may not be opened using Java script. Maybe the follwing will work:
opener.location.href =
or
opener.opener. .... and then whatever you want
0
 
gery128Commented:
is the pop-up window blocker is on in IE?
0
 
vbnetcoderAuthor Commented:
It pops up but closing is the problem
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
vbnetcoderAuthor Commented:
I turned off the popup blockers and not I get this error:


Microsoft JScript runtime error: 'window.opener.location' is null or not an object
0
 
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
Hi, you have to call the javascript function with onClientClick event of any control.
0
 
vbnetcoderAuthor Commented:
samirbhogayta:

I don't know what you mean .. could you show me?
0
 
gery128Commented:
are you using IE8 to test it? Then see this link:
http://social.msdn.microsoft.com/Forums/en/iewebdevelopment/thread/0c014e78-8d35-4df3-93da-7f6a30b4ed8b

You should change your approach to open modal dialog box for better compatibility.
0
 
vbnetcoderAuthor Commented:
It is IE 8
0
 
gery128Commented:
Please see this link and check if the Security permission is same mentioned in this link:
http://social.msdn.microsoft.com/Forums/en/iewebdevelopment/thread/0c014e78-8d35-4df3-93da-7f6a30b4ed8b

Also, consider using other alternatives, like modal popup

http://stackoverflow.com/questions/4885765/window-opener-alternatives
0
 
jkofteCommented:
can you check my article here ?

http://kadirselcuk.com/?p=78
0
 
vbnetcoderAuthor Commented:
jkofte:


I no very little about javascript this is what I was doing in my asp.net code that worked in Chrome

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ImageType = Request.QueryString("ImageType")
        ProductID = Request.QueryString("Product_ID")
     

        btnNo.OnClientClick = "javascript:window.opener.location.reload();self.close();"

    End Sub


should I change the line

   btnNo.OnClientClick = "javascript:window.opener.location.reload();self.close();"

to say something different?
0
 
jkofteCommented:
actually what you were doing should work. my code would close the window without yes/no prompt.

did you try to copy and paste the address of the "pop-up page" into IE from Chrome ?

if so, it is normal that it cannot find its opener in IE 8.

You should start testing from "Opener page" in IE and then click to open the pop-up page.

Both pages must be in IE. You can't manipulate a page in Chrome via an event from a page in IE.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now