Solved

java script error in internet explorer

Posted on 2011-03-11
12
326 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

747 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

10 Experts available now in Live!

Get 1:1 Help Now