473,698 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1901
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*****@litote s.demon.co.uk> wrote in message news:<c4******* ************@ne ws.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
4787
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 popup A. How do i refer to the very first parent window? Visual...
3
9829
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 user interface. how should have get window handle from managed windows? Thanks in advance. Sushil
5
2511
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 database the DataGrid is using as a data source. When the popup window is closed I want to refresh the main window -- i.e., cause a postback to happen. Is this possible?
2
2428
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 javascript function in the .aspx file and used the following to call the javascript function from the popup window
9
3342
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 visible to a client using a browser. My question is...can a knowledgeable browser user view Jscript source code in an asp file?
2
1619
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 (Window3). I need to call a funcion that resides on Window1 from Window3. I do this successfully by calling a function with window.opener on Window3, which calls a function with window.opener on Window2, which calls a function on Window1. My...
1
3919
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 test1.jsp. The iFrame src points to a page called test2.jsp. It has a resize attribute that calls a javascript function that is located in test1.jsp. In the test2.jsp page, it doesn't recognize the function that is located in test1.jsp page. Is there...
94
3215
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): return p;
7
4423
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 and IE as a 'caller' property of function objects, and it seems Konqueror/Safari now have it too. Opera doesn't. And what bothers me is that it is marked as 'deprecated'. I've seen people I respect swear by their lives that it is *good* to
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9155
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9018
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8890
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8858
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.