Click here to Skip to main content
11,789,706 members (60,105 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript IFrame IE9 , +
I am developing a web application using Dojo v1.8 and my target machine runs IE9 and Silverlight 5.1.20125. In this web app, the user can select a tool from a toolbar at the top of the page that will open up in a content pane (or an IFrame if it is an external tool) below the toolbar (only one tool can run at a time).

The bug I am encountering is that one of the external tools that opens in an IFrame runs a Silverlight app, and if the user tries to select another tool, the new tool won't open and the Silverlight application stays there. After checking the DOM Tree, all references to the Silverlight application have been wiped, and the new tool is there instead (which is the desired behavior).

So my question is, why is the Silverlight Application still being viewed even when it is gone from the DOM Tree, and is there a way to programmatically close it from Javascript? Also, I do NOT have access to the source code of the Silverlight Application.

The code for clearing out the div (_targetNode) which holds the current tool is as follows:

while(_targetNode.hasChildNodes()) {
     var widgetInstance = dijit.byId(;
     // If this is undefined, then the tool is not a dijit widget
     if (typeof widgetInstance == "undefined") {
          // My first attempt to resolve the issue.  It had no effect.
          if(_targetNode.lastChild.tagName.toUpperCase() == "IFRAME") {
     } else {
          // This is a dijit widget, so call it's destroy function
Posted 6-May-13 9:26am
Edited 6-May-13 9:27am
db7uk at 6-May-13 17:08pm
I had a similar issue. Is the silverlight app inside a div? can you not hide the div before closing the window. For me it was a z-index / display issue as modal windows over the top would not show. Maybe not what you were after but may help
GrizzlyJames at 6-May-13 19:02pm
It appears to be inside of a div. My DOM Tree is as follows (the relevant parts anyways):
<div id="mainContentBorder>
<div id="mainContent"> <!-- This is what _targetNode is from the code above -->
<iframe> <!-- This is the iframe I create, from here on, I have no control -->
<div id="silverlightControlHost">
GrizzlyJames at 7-May-13 11:54am
Turns out I can't get to the silverlightControlHost div. Everytime I try to get the contentWindow or contentDocument of the iframe I create I get an "Access is denied" error. I would imagine that's because I'm going to a different domain.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Well I did not manage to solve this issue directly. However, there was another bug that I ran into which involved the java swing library not working on the production machine. The solution was to add the following tag as the first element of head:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"></meta>

This forces IE to use IE8 instead of IE9. This trick solved this other issue, but inadvertently solved this issue as well. Here are several links that helped lead me to the solution (amongst others):

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 999
1 Maciej Los 765
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 430

Advertise | Privacy | Mobile
Web02 | 2.8.1509028.1 | Last Updated 26 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100