Solved

java script error in internet explorer

Posted on 2011-03-11
12
327 Views
Last Modified: 2012-05-11
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
Comment
Question by:vbnetcoder
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 1

Expert Comment

by:janvanderwijk
ID: 35108956
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
 
LVL 9

Expert Comment

by:gery128
ID: 35109193
is the pop-up window blocker is on in IE?
0
 

Author Comment

by:vbnetcoder
ID: 35109226
It pops up but closing is the problem
0
 

Author Comment

by:vbnetcoder
ID: 35109267
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
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
ID: 35109274
Hi, you have to call the javascript function with onClientClick event of any control.
0
 

Author Comment

by:vbnetcoder
ID: 35109289
samirbhogayta:

I don't know what you mean .. could you show me?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Expert Comment

by:gery128
ID: 35109372
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
 

Author Comment

by:vbnetcoder
ID: 35109507
It is IE 8
0
 
LVL 9

Expert Comment

by:gery128
ID: 35109587
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
 
LVL 9

Expert Comment

by:jkofte
ID: 35109898
can you check my article here ?

http://kadirselcuk.com/?p=78
0
 

Author Comment

by:vbnetcoder
ID: 35110015
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
 
LVL 9

Accepted Solution

by:
jkofte earned 500 total points
ID: 35147605
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now