Learn how to a build a cloud-first strategyRegister Now

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

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

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
pborregg
Asked:
pborregg
  • 2
  • 2
  • 2
1 Solution
 
COBOLdinosaurCommented:
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
 
leakim971PluritechnicianCommented:
>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
 
pborreggAuthor Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
leakim971PluritechnicianCommented:
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
 
COBOLdinosaurCommented:
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
 
pborreggAuthor Commented:
Thanks
0

Featured Post

Technology Partners: 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!

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