473,320 Members | 1,846 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,320 software developers and data experts.

Obtaining a variable value

Hi gang. As with any other post, I am working on a project and have
gotten stuck. I am trying to obtain a variable value in the parent
webpage from an <iframe>. For instance:

Parent Page code
----------------
<html>
.... heading tags
<body>

<iframe name="testing" marginwidth="1" marginheight="1"
src="http://www.interneturl.com/webpage.php" height="160" width="300"
scrolling="no" border="0" frameborder="0">&nbsp;</iframe>

</body>
</html>
When I try to access a variable value in that <iframe> it gives me the
error:
"uncaught exception: Permission denied to get property
Window.variablename". Obviously the <iframe> contains code from a
webpage that is not in the local domain (ie a local file). Would this
be causing the problem? If so, is there a way to get around this? I
have tried accessing the variable value from the ways listed below:

testing.variablename *seems to work on local files*
testing.document.variablename
parent.frames['testing'].variablename
parent.frames['testing'].document.variablename
frames['testing'].variablename
frames['testing'].document.variablename

Any help that can be given will be greatly appreciated... thanks in
advance.

Dave

Jul 23 '05 #1
3 1742
In article <11*********************@g14g2000cwa.googlegroups. com>,
he******@yahoo.com enlightened us with...
When I try to access a variable value in that <iframe> it gives me the
error:
"uncaught exception: Permission denied to get property
Window.variablename". Obviously the <iframe> contains code from a
webpage that is not in the local domain (ie a local file). Would this
be causing the problem?
Yes.
You're only allowed to access documents from the same domain and protocol.
If so, is there a way to get around this?


No. Not with client-side javascript. (if there is, it's a security hack)
Can you imagine what unscrupulous people could do if it were allowed?

If both pages belong to you, use parameter passing via the URL or cookies.

--
--
~kaeli~
Santa's helpers are subordinate clauses.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Thanks for your reply Kaeli. I guess I will have to rethink my plans
on how to get this variable value.

I do have another question for everyone. Is there anyway you can get
javascript to sync time with a national time server? Any examples are
welcomed.

Dave

Jul 23 '05 #3
In article <11**********************@o13g2000cwo.googlegroups .com>,
he******@yahoo.com enlightened us with...
Thanks for your reply Kaeli. I guess I will have to rethink my plans
on how to get this variable value.

What is the variable used for?
Is the page yours? You have a lot more options if it is.

Do you have a server-side scripting language, such as PHP, available? Server-
side languages can read in contents from a URL. Javascript can, too, but it
needs help. Check this out.
http://jibbering.com/2002/4/httprequest.html
I do have another question for everyone. Is there anyway you can get
javascript to sync time with a national time server?


Depends. You run into the same issue as your other problem -- javascript
talking to another server. With possibly the same solution (http request or
using server-side scripting).
Do they have a web service?

--
--
~kaeli~
I love God. It's His fanclub that I can't stand.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

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

Similar topics

9
by: Roger Withnell | last post by:
I'm inserting a new record into an MS SQL database table and I want to obtain the new records autonumber immediately afterwards, as follows: MadminRS.CursorLocation = adUseServer...
4
by: __jakal__ | last post by:
Hello, I need to find out the time difference between UTC and local time. I am doing it the following way #include <sys/timeb.h> #include <stdio.h> int main() { struct timeb tp; ftime(&tp);
11
by: John Nagle | last post by:
The Python SSL object offers two methods from obtaining the info from an SSL certificate, "server()" and "issuer()". The actual values in the certificate are a series of name/value pairs in ASN.1...
3
by: psujkov | last post by:
Hi everybody, int f(int a, int b) { return a + b; }; is it possible to obtain this function signature - int (int, int) in this case - for use in boost::function_traits ? e.g. std::cout << "f's...
8
by: The Cool Giraffe | last post by:
I'm playing around with pointers trying to figure out how the operator & works. My impression was that it can be used to create a pointer to a thingy. So, i created the following code and ran it....
5
by: mallz | last post by:
hi, i need to get the value of the variable which i have put into a session variable in another jsp form. Im using this to get the value: (String)session.getAttribute("thename") But, im not...
1
by: Cartik | last post by:
Hello, This question is regarding applying an XSL transformation to map one XML file to another. Im posting this question again. Say I have original XML attributes like: <series> ...
15
by: kris | last post by:
Hi I am writing a small program where I need to obtain the actual size of a structure. The programm is as follows struct abc { int j; char k; int i; }*a;
7
by: Ebenezer | last post by:
Hello! Let's suppose we have an XML with some nested NODE nodes: <root attr="first"> <node id="1" attr="mike"> <node id="2" /> <node id="3" attr="dave" /> </node> <node id="4">
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.