473,406 Members | 2,293 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,406 software developers and data experts.

How to send message from top to iframe (frame) when pages are on different servers?

Hi

The problem is:
I want to allow partially display my page in iframed version, but only
for one address.

top page (http://location1/top.html) code: <iframe name='iframed'
id='iframed' src='http://location2/iframe.html'></iframe>

I cannot call any function from top or parent in case of security
errors.

I tried to:

1. check if this.name == 'iframed'
This worked unless one click to any link in the iframed page (the
name changes)

2. check top.location value
Breaks in case of security bug

Is there any way to send any information to iframed page or receive any
information about top page?
Of course where page location servers are different ?

Piotr

Mar 21 '06 #1
2 2170
Keep in mind that it's rediculously easy to thwart this if someone is
trying to, but it will stop the automated ones:

<iframe name='iframed'
id='iframed'
src='http://location2/iframe.html?inmyframe=true'></iframe>

Then parse out the querystring and make sure it says what you want it
to say.

It's possible that you could use document.referrer instead, but I'm not
sure all the implications of that with how your iframed page moves.

Mar 21 '06 #2
zalun wrote:
I want to allow partially display my page in iframed version, but only
for one address.

top page (http://location1/top.html) code: <iframe name='iframed'
id='iframed' src='http://location2/iframe.html'></iframe>

I cannot call any function from top or parent in case of security
errors.
Exactly. Search the archives for "Same Origin Policy".
Is there any way to send any information to iframed page or receive any
information about top page?
Generally, no. Especially, the protocols, the second-level domains, and the
port addresses of the two URI references must be the same, or you will have
to use a signed script to request the required privileges (or lower the
security level of the user agent, but that is not recommended).
Of course where page location servers are different ?


The physical location does not matter, the logical one (addressing) does.
PointedEars
Mar 22 '06 #3

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

Similar topics

1
by: Sean Nolan | last post by:
So it's always been easy to know if I'm running framed: if (window != top) .... Here's one I can't seem to figure out. Is there a way to determine if the frame I am in is a FRAME or an IFRAME?...
3
by: Dany P. Wu | last post by:
Hi everyone, I am trying to create a site with pages containing iframes. This is the first time I've used inline frames and am still struggling with the concept. This site will have 10 pages...
2
by: google | last post by:
I have a HTML file that contains an iframe. The HTML file is served by one server. The iframe contains a link to a completely different server. My question is, can any action in the iframe (such...
3
by: coolsti | last post by:
I need some help here. I am making an application which allows a user to look at a series of picture files one at a time, and enter the outcome of various visual tests to a database. The...
6
by: Valued Customer | last post by:
Hello, I'm really at a loss here. I have the following index.html: <div align="center"> <iframe src="left.htm" width="15%" height="100%" frameborder="0" name="left" target="contents">...
26
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
1
by: bulldog8 | last post by:
I am working on a picture preview page ... some questions and suggestions have been incorporated already, but the 'user' (i.e. wife!) would like it to be more user friendly (if it isn't one thing,...
0
by: johnw182 | last post by:
Ok, I have a asp.net project. Everything works great. HOWEVER, this project was made to be called from within a frame or iframe. When being used within the iframe the user gets a blank frame when...
68
by: zwsdotcom | last post by:
I've been looking for references for some weeks now, but haven't found an answer to the following question. I'd love some help on this: *Without* using JavaScript or other active client-side...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
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...
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.