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

"Accsss is denied" when using iframe.contentWindow.document

Hi everybody,

My goal is to set the height of the iframe to fit its content. There
was an earlier posting which gave some useful insights.

http://groups.google.com/groups?hl=e...BIFrame%2Bsize

The key idea is

function getInnerHeight(iframe){
var d=iframe.contentWindow ?
iframe.contentWindow.document :
iframe.contentDocument;
var h=0;
if(d){
if(d.documentElement && d.compatMode &&
d.compatMode=="CSS1Compat")
h=d.documentElement.scrollHeight;
else if(d.body)
h=d.body.scrollHeight;
if(h) h+=getInsets(d);
} return (h||300)+"px"; //300 is a default value
}

<iframe src="javascript:top.writeSomeText()"
width="559"
onload="this.style.height=getInnerHeight(this)"></iframe>

It works perfectly if the src of iframe is some local content.
Unfortunately, if I put src="http://www.yahoo.com", the line
iframe.contentWindow.document returns "access is denied" error.

Do you have any idea how to solve this problem?

Thanks
Dom
Jul 23 '05 #1
5 22069
On 7 Sep 2004 11:22:04 -0700, Dominic <do****@hotmail.com> wrote:

[snip]
It works perfectly if the src of iframe is some local content.
Unfortunately, if I put src="http://www.yahoo.com", the line
iframe.contentWindow.document returns "access is denied" error.

Do you have any idea how to solve this problem?


Generally, it can't be. See the FAQ, specifically section 4.19, for more
information.

<URL:http://jibbering.com/faq/>

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
Dominic wrote:
It works perfectly if the src of iframe is some local content.
Unfortunately, if I put src="http://www.yahoo.com", the line
iframe.contentWindow.document returns "access is denied" error.


It looks like an XSS thing -- there probably isn't a way around it. If
there is a way around it then the workaround will probably stop working
when you upgrade your browser.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./keane/hopes_and_fears/08_sunshine.ogg

Jul 23 '05 #3
On 7 Sep 2004 11:22:04 -0700, Dominic <do****@hotmail.com> declared in
comp.lang.javascript,alt.html,microsoft.public.scr ipting.jscript:
It works perfectly if the src of iframe is some local content.
Unfortunately, if I put src="http://www.yahoo.com", the line
iframe.contentWindow.document returns "access is denied" error.

Do you have any idea how to solve this problem?


Stop trying to breach copyright.

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004
Jul 23 '05 #4
Mark Parnell <we*******@clarkecomputers.com.au> wrote in message news:<1c*******************************@40tude.net >...
On 7 Sep 2004 11:22:04 -0700, Dominic <do****@hotmail.com> declared in
comp.lang.javascript,alt.html,microsoft.public.scr ipting.jscript:
It works perfectly if the src of iframe is some local content.
Unfortunately, if I put src="http://www.yahoo.com", the line
iframe.contentWindow.document returns "access is denied" error.

Do you have any idea how to solve this problem?


Stop trying to breach copyright.


I think there may be a misunderstanding. "http://www.yahoo.com" is
only used to illustrate the situation of getting some remote content.
The remote content may come from our server of another domain name, or
from our partner. I realize that this is a problem as long as the data
is not located at local server.

Hope it is clear. I'm sorry if my earlier posting leads to the
misunderstanding.

Dom
Jul 23 '05 #5
Dominic wrote:
It works perfectly if the src of iframe is some local content.
Unfortunately, if I put src="http://www.yahoo.com", the line
iframe.contentWindow.document returns "access is denied" error.


<http://groups.google.de/groups?as_q=Same+Origin+Policy&as_ugroup=comp.lang .javascript&scoring=d&filter=0>

Please stop crossposting.
PointedEars, F'up2 cljs
--
The truth is out there... and so are the bugs...
Jul 23 '05 #6

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

Similar topics

1
by: Darren Lew | last post by:
Hi there, I have this problem which is really driving me nuts for a couple of days. Glad if any help or suggestion is given Javascript will give me a pop-up error "Access is denied" when i try...
2
by: deko | last post by:
Why am I getting: "Error Number 70: Permission denied" when trying to move a folder with the Microsoft Scripting Runtime? Is there some security setting I don't know about? Platform: Windows...
0
by: Rico | last post by:
Helolo, I have an ASP.NET application on a Windows 2003 Server machine WITHOUT VS. I am working on an XPPro machine with VS 2003. I have installed the remote debugging components on the server....
1
by: gslim | last post by:
I am trying to implement the busybox sample from // From Mark Wagner // http://blogs.crsw.com/mark/articles/642.aspx When I get to this line I get an access denied error. Could someone give me...
1
by: Alex Maghen | last post by:
I'm getting the error "HTTP Error 403.1 - Forbidden: Execute access is denied" when I try to reach my ASPX pages. Before I go giving Windows permissions to my docroot, etc., I want to...
1
by: srivatsans101 | last post by:
Hi, I'm trying to access the IFrame contents on a HTML page as frames.document But in IE, I'm getting Access Denied Error Message. I tried to add the IFrame's Src WebSite (a...
0
by: Michael Leithold, WWK | last post by:
Hello, If I loop through all the processes on my machine, for some processes I get "Access Denied" when trying to read the file name associated with the process. Also some other properties are...
1
by: Snolly | last post by:
Hi all, I am using the open source dojo toolkit v .4.3 (I know it's old but can't upgrade). I have a page with an iframe in it. When the page loads, the iframe is pointing at a local resource...
2
by: sphinney | last post by:
Hi everyone. I have a form in my Access 2007 database with a Microsoft Office Document Imaging Viewer Control 12.0 object on it. The object is named "GRAPHIC_mdv". When the form opens I want to...
1
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
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?

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.