Solved

java script error in internet explorer

Posted on 2011-03-11
12
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
Suggested Courses

752 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