Developer/Designer Notes

SVG DOM access results in “Access Denied” in IE

Posted by Kiran Mova on March 22, 2007

Is the JavaScript access to the SVG DOM embedded in an iFrame resulting in “access denied?”. Better yet, was it working in IE6 and stopped working now?

Check if your PC has the following microsoft patch installed :  kb925454. (On XP Service Pack 1 or Service Pack 2). This patch fixes some of the vulnerabilities in cross-domain scripting. But it affects badly the pages that make extensive use of iframes and cases where parent frame needs to access the contents of the iframes using DOM.

I understand, there are valid reasons for doing this. But now that made me to look for alternative approaches for designing my page. My page consists of an iFrame that has an SVG object in it. From the parent window, I need to access the elements of my SVG and modify them.

IE throws an “access denied” when it sees – “document.iframeobj.document.embeds[]..” It doesn’t allow me to inspect the iframes document, even when the SVG object embedded is coming from the same domain. (It got to my nerves.)

Then I found this article at the Adobe’s SVG forum archive – “Problem with Microsoft Internet Explorer KB925454 patch” (Sorry, can’t provide a link, that won’t break. I accessed the google cache page to read the post. Adobe requires the users to be logged in to read it. Why!!)

The reply to that problem showed me a solution with the infamous “EMBED” tag.

For now, I got my page to work with EMBED tags, but it won’t be long before I need to shift to a standard tag like “OBJECT”. I am yet to explore the possibilites with the object tag. If you are interested, check this article at A List Apart

One disadvantage of the EMBED tag is that, I couldn’t change the “src” attribute of the tag at run time. Well, not quite right. The IE allowed me to change the value, but it made no difference.

Also, I came across something called HTA – HTML Application. It probably is a valid approach if you don’t need to access the HTML pages over the web.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: