Solved

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

Posted on 2012-03-21
6
231 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
  • 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

758 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

21 Experts available now in Live!

Get 1:1 Help Now