Solved

How to call a javascript function on a page that is NOT the opener.

Posted on 2012-03-21
6
235 Views
Last Modified: 2012-03-27
Hello, I have a page called attach.asp for lack of a better name. Tabs.asp is part of attach.asp.  Attach.asp shows up in the browser URL but tabs.asp does not.  A popup child window is opened from tabs.asp called, popupwin.asp for lack of better name as well.  A function that lives on attach.asp needs to be called from popupwin.asp, but, since the parent opener for popupwin.asp is tabs.asp, I can't call the function on the parent of the parent.

So, I've tried window.opener.functionname() and I get a null object reference.

I've tried parent.window.opener, parent.location.window.opener, and nothing seems to work.

What's bizaar is this tabs.asp window doesn't reside in an iFrame, but is referenced somehow in another way, which I'm still trying to explore.

So does anyone have any thoughts on how to call a function from a child that resides on the parent of an object that's not really there?

Thanks,

P
0
Comment
Question by:pborregg
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37748972
If an object does not exist then it cannot have properties or functions. I have no idea what you are doing it that way but, it will never work.  

Trying to to do cross page scripting is a bad idea about 99% of the time.  Re-consider your design to see if you can get rid of the maze and do things in a straight line.


Cd&
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37748975
>What's bizaar is this tabs.asp window doesn't reside in an iFrame, but is referenced somehow in another way, which I'm still trying to explore.

we need the answer of this question... or give a link to let we answer it.
0
 

Author Comment

by:pborregg
ID: 37749090
It's not my code. I'm working as a contractor with 10,000 pages of code, literally.  It's like finding a needle in a haystack. Unfortunately I cannot give the URL since it's for a US Govt Agency.

I did run this to find the parent and got nothing.

             var origWin = window.opener;
                  try
                  {      
                        if (origWin != null)
                        {
                              alert(origWin.parent.location);
                        }
                   }
                  catch(e)
                  {
                  
                        alert(e.description);
                  
                  }

But it may be in the wrong place in the code... I'll keep at it.  Thanks for your help.
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!

 
LVL 82

Expert Comment

by:leakim971
ID: 37749217
and what about a small screen copy? Maybe tabs.asp is a CSS popup..
and maybe with an iframe inside
can you move tabs.asp outside attach.Asp
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 37749238
It is possible that the main page closes tab after it opens the popup I might just be using it for a conduit to prevent the popup from accessing the main page.  Having worked on projects for the government it would not surprise me that you are running up against some old security trick that might have been necessary at one time.  I assume ther is little or no documentation.


Cd&
0
 

Author Closing Comment

by:pborregg
ID: 37772617
Thanks
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

Suggested Solutions

Title # Comments Views Activity
Javascript object functions help 1 19
Use "if not" in a condition 2 19
Table doesn't show the lines! 3 24
assigning javascript variable to php variable 8 42
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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

749 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