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

Cross domain iframe dynamic height change issue.

HI,
I am trying to display the content of a iframe in a div tag so that I can control the size of the display dynamically. The problem here is that the domain are different for parent window and the iframe content.

Code :
=====
Expand|Select|Wrap|Line Numbers
  1. var x=document.getElementById('myIFrame');
  2.  
  3. try{
  4.     x = x.contentWindow.document.body.innerHTML
  5. }catch (e){
  6. alert(e.message); 
  7. }
  8.  
I am getting a "Access denied" exception. Is there a work around for the issue.

Please help.

Thanks
Sreenath
[removed email]
Aug 20 '08 #1
4 10264
acoder
16,027 Expert Mod 8TB
To get the content, the only workaround is to serve it from your own domain using a proxy.
Aug 20 '08 #2
@acoder

Hi,

How exactly does this work?

I am hosting a web-site that is supposed to be shown in a great number of different sites, via an iframe. So the problem is really on the receiver's end: they would want to setup their iframe so that it receives our dynamic content with automatic height.

Is it possible for me to teach all of these receivers how to implement the workaround you mention? Or do you reckon the fix is too complicated, and they have to settle for a fixed height (a very sub-optimal solution)?

Any answers welcome. Also: if I have not provided enough information, tell me, and I'll expand on it.

Thanks. Erik
Feb 5 '09 #3
Hi,

my task with the iframe seems difficult, from googling the issue.

Therefore, I am trying to think workarounds.

One possibly important issue here, is that the content that is produced on my site, will ONLY be used by other sites using IFRAME. That means, I can do whatever I want with the pages that are going to show in the iframe windows (except, due to contant issues, making them the same height...)

What I'm thinking is:

Is it possible to set up some kind of service, that automatically starts when a page is called for at my server, and first feeds some information to the recipient (i.e. document heigth). THen the recipient would use this information when setting up the page with the iframe, thus being able to set the correct iframe height?

Dunno if this makes sense, as I am not too familiar with the technicalities here, but if you need more information, let me know.

Thanks,

Erik
Feb 5 '09 #4
acoder
16,027 Expert Mod 8TB
There's a few workarounds based on the fragment identifier or using an extra iframe. They would usually involve some sort of collaboration between the two domains. One way you could get it to work is if you have an iframe within your page content that has the same domain as the parent domain. The other is described here.
Feb 7 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Cindy Lee | last post by:
I'm trying to dynamically set the height of my Iframe. my https: main page is calling another https in an Iframe. But i get an access denied error from my javascript trying to call the parent...
6
by: SF RVN | last post by:
I have searched NUMEROUS sources in an effort to find the magic (script, styles, syntax, etc.) that will allow me to create a web page with the following format: ...
1
by: Robert de Ridder | last post by:
I use an asp page to display pages, where the dynamic content is in an iframe. To calculate the height of the iframe I use the calcheight function. However when trying to do this with external...
3
by: Vongza | last post by:
<html> <head> <title>Cross Frame Reference</title> <script language="javascript"> function showThisTitle() { alert(document.title); } function showAnotherTitle() { try {...
3
by: aspmonger | last post by:
Hello, I really believe that IE 6 has a new (intentional?) bug that severely limits the capability of dhtml and cross domain scripting. Yesterday, I read an interesting article about the subject and...
5
by: dolittle | last post by:
Hi, I`m trying to read the href property of an iframe with a javascript that running in the main frame. When the main frame and the inner iframe are both from the same domain I can read it with:...
1
by: chaitanyadotcom | last post by:
As per my application i need to create tabs using iFrame dynamically. There are totally 4 buttons in my application where for each button i provide a link. Where in it will dynamically create a tab...
1
by: raviviswanathan.81 | last post by:
Hello, So we have a webmaster who sets document.domain to some domain. After that, we try to create and inject text inside an iframe by getting the iframeID.contentDocument (or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.