[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2012-03-21
6
Medium Priority
?
244 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
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!

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

649 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