473,398 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Can't get function caller if the caller is from a function within a popup window

The situtation is that I'm trying to ensure that certain functions are
only called by functions that I want them to be called from. I have a
popup window which has a function which calls a function in the opener
window (this works fine). The only thing is when I go to get the
caller property of the function in the opener window it is null, it
does not return the function in the popup window that called it.

Any ideas?
Jul 20 '05 #1
2 1878
Mark wrote:
The situtation is that I'm trying to ensure that certain functions are
only called by functions that I want them to be called from. I have a
popup window which has a function which calls a function in the opener
window (this works fine). The only thing is when I go to get the
caller property of the function in the opener window it is null, it
does not return the function in the popup window that called it.


The - caller - property was not standardised into ECMAScript so it isn't
that widely supported. But separate browser windows are separate script
environments and they usually care about which window various object
belong to (functions being objects in this sense).

Usually though, you prevent functions that should not call other
functions form doing so by not coding the function calls into the bodies
of those functions. You seem to have something else in mind entirely, so
it is probably going to be necessary to answer the question: why?

Richard.
Jul 20 '05 #2
"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message news:<c4*******************@news.demon.co.uk>...
Mark wrote:
The situtation is that I'm trying to ensure that certain functions are
only called by functions that I want them to be called from. I have a
popup window which has a function which calls a function in the opener
window (this works fine). The only thing is when I go to get the
caller property of the function in the opener window it is null, it
does not return the function in the popup window that called it.


The - caller - property was not standardised into ECMAScript so it isn't
that widely supported. But separate browser windows are separate script
environments and they usually care about which window various object
belong to (functions being objects in this sense).

Usually though, you prevent functions that should not call other
functions form doing so by not coding the function calls into the bodies
of those functions. You seem to have something else in mind entirely, so
it is probably going to be necessary to answer the question: why?

Richard.


Thanks for the reply Richard. I have since found a way to do what I
need without using the caller property. I had the popup function parse
its name as a string argument to the opener window function and then
eval the string to test if the popup function existed. The last line
of the popup function being self.close() so that the eval would fail
when the popup was closed. I also used the onFocus event handler in
the opener window to close the popup when it lost focus.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MEM | last post by:
Hello, I'd like to refresh the main or top most browser window from a child window. Specifically, child popup A is opened by a main browser window then child popup B is opened from within child...
3
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has...
5
by: Jay | last post by:
I have a situation where the user clicks on a button in a DataGrid to launch a popup window via javascript. In the popup window the user does some things that result in changes to the underlying...
2
by: Michelle Stone | last post by:
I have an asp.net form, which calls a popup window. The popup window, based on some user input should call a function on the parent window. Is this possible? I have tried creating a...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
2
by: M B HONG 20 | last post by:
Hi all - I am working on a web application and have run into a problem. From a main window (Window1) I open a child window (Window2), and from that child window I open a grandchild window...
1
by: jadeite100 | last post by:
Hi: I am using IE 6 SP2. My resize attribute does not work <body onresize="test1();">. When I resize my window, the resize event doesnot get call. I have a jsp page with an iFrame called...
94
by: Chad | last post by:
On to top of page 163 in the book "The C Programming Langauge" by K & R, they have the following: char *strdup(char *s) { char *p; p=(char *)malloc(strlen(s)+1); if( p != NULL) strcpy(p,s):...
7
by: =?UTF-8?B?QW50w7NuaW8gTWFycXVlcw==?= | last post by:
Hi, Sorry if this's been discussed before, I couldn't find it. As well you know, the ECMAScript standard doesn't include any way to access a function's caller. This has been available on Mozilla...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.