472,794 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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 1704
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">
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.