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

IHTMLPopup Error - Cross Frame Security

I am building a BHO that is meant to popup a IHtmlPopup window on a
mouse over image event. All the code works fine if the image is in the
main Window.

However if the image is in a frame then I get the following error:

{"Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))"} System.Exception
{System.UnauthorizedAccessException}

This happens when I try to create the Popup Window or access its
Document
The code below is in C#, but I think it would apply to C++ too.

I have tried getting the parentWindow from the Frame's document and
from the main document.
//IHTMLWindow4 parentWindow = (IHTMLWindow4)FrameDocument.parentWindow;
IHTMLWindow4 parentWindow = (IHTMLWindow4)PageDocument.parentWindow;

//This line will work, but if you look at the Document Property, you
will see the exception
IHTMLPopup popUp = (IHTMLPopup)parentWindow.createPopup( ref argIn );
//This line will throw the exception
IHTMLDocument2 popupDoc = (IHTMLDocument2)popUp.document;
Any ideas?

Jul 8 '06 #1
2 4482
The only way to prevent this that I know of is to change the setting in
Advanced section of client browser (IE) settings. You cannot acess the
contents of a frame (IFRAME) whose source is another domain, for security
reasons.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"rb******@metacrawler.com" wrote:
I am building a BHO that is meant to popup a IHtmlPopup window on a
mouse over image event. All the code works fine if the image is in the
main Window.

However if the image is in a frame then I get the following error:

{"Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))"} System.Exception
{System.UnauthorizedAccessException}

This happens when I try to create the Popup Window or access its
Document
The code below is in C#, but I think it would apply to C++ too.

I have tried getting the parentWindow from the Frame's document and
from the main document.
//IHTMLWindow4 parentWindow = (IHTMLWindow4)FrameDocument.parentWindow;
IHTMLWindow4 parentWindow = (IHTMLWindow4)PageDocument.parentWindow;

//This line will work, but if you look at the Document Property, you
will see the exception
IHTMLPopup popUp = (IHTMLPopup)parentWindow.createPopup( ref argIn );
//This line will throw the exception
IHTMLDocument2 popupDoc = (IHTMLDocument2)popUp.document;
Any ideas?

Jul 8 '06 #2
Thanks Peter,

I guess I should clarify my question a little. I know that I am
experienceing Cross Frame security issues. What I am trying to achieve
is to popup some sort of a tooltip equivalent on a mouseover event.

I think my code is causing the cross frame security issue because I am
not using the correct windows to create the popup. In my code I said I
tried the two methods:
//IHTMLWindow4 parentWindow = (IHTMLWindow4)FrameDocument.parentWindow;
IHTMLWindow4 parentWindow = (IHTMLWindow4)PageDocument.parentWindow;
OageDocument is the main Document and I can see why this would go wrong
when using Frames.

FrameDocument is the document of the Frame of the element over which
the mouse is hovering. I therefore figured that
FrameDocument.parentWindow will return me the right window to create a
popup. Obviuosly that does not seem to be the case.

Any idea, then, as to which Window I should be using? I know the
element I am hovering over, the document of the frame and the main
document.

Peter wrote:
The only way to prevent this that I know of is to change the setting in
Advanced section of client browser (IE) settings. You cannot acess the
contents of a frame (IFRAME) whose source is another domain, for security
reasons.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"rb******@metacrawler.com" wrote:
I am building a BHO that is meant to popup a IHtmlPopup window on a
mouse over image event. All the code works fine if the image is in the
main Window.

However if the image is in a frame then I get the following error:

{"Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))"} System.Exception
{System.UnauthorizedAccessException}

This happens when I try to create the Popup Window or access its
Document
The code below is in C#, but I think it would apply to C++ too.

I have tried getting the parentWindow from the Frame's document and
from the main document.
//IHTMLWindow4 parentWindow = (IHTMLWindow4)FrameDocument.parentWindow;
IHTMLWindow4 parentWindow = (IHTMLWindow4)PageDocument.parentWindow;

//This line will work, but if you look at the Document Property, you
will see the exception
IHTMLPopup popUp = (IHTMLPopup)parentWindow.createPopup( ref argIn );
//This line will throw the exception
IHTMLDocument2 popupDoc = (IHTMLDocument2)popUp.document;
Any ideas?
Jul 9 '06 #3

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

Similar topics

6
by: Charles Crume | last post by:
Hello; My index.htm page (www.charlescrumesoftware.com for those interested in looking) contains 3 frames (left = content, top right = logo, bottom right = navigation). This domain name is...
5
by: Jim Marquardson | last post by:
Hi, I've struggled with this for a while now, so I'm asking for help. I am trying to click on a link in one page, have that link open up in a new window, and set that newly opened window's...
7
by: Scott M. | last post by:
How can I disable the cross-site scripting check for one particular page of a site?
3
by: Vongza | last post by:
<html> <head> <title>Cross Frame Reference</title> <script language="javascript"> function showThisTitle() { alert(document.title); } function showAnotherTitle() { try {...
9
by: permanent.tourist | last post by:
I'm having a hell of a job getting this to work in Safari: the only thing I can think of is that one can't use reload() across to another frame for security reasons. Does anyone have a concrete...
4
by: taoberly | last post by:
Hello, Is it possible to run an HTML file from "localhost" and bypass the various security checks in place for cross-frame scripting? For example, on a 2-frame page loaded locally: a) frame...
4
by: Adrian | last post by:
can someone explain the cross domain security re AJAX in IE? I have a page that calls a web service (WS) from another domain (the target browser is only IE6) and displays it's results! all works...
2
by: KZSteele | last post by:
hello - i am using VBA within a microsoft access project to automate internet explorer. what i am doing is reading data from various frames in the IE window and loading them into a table. ...
0
by: KZSteele | last post by:
(repost/edit from html forum) hello - i am using VBA within a microsoft access project to automate internet explorer. what i am doing is reading data from various frames of my company's web...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.