Click here to Skip to main content
Rate this: bad
good
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(_targetNode.lastChild.id);
 
     // 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") {
               _targetNode.lastChild.contentWindow.close();
          }
          _targetNode.removeChild(_targetNode.lastChild);
     } else {
          // This is a dijit widget, so call it's destroy function
          widgetInstance.destroy();
     }
}
Posted 6-May-13 10:26am
Edited 6-May-13 10:27am
v2
Comments
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):
<html>
<head>...</head>
<body>
<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 -->
<html>
<head>...</head>
<body>
<form>
<div id="silverlightControlHost">
<object>...</object>
<iframe>...</iframe>
</div>
</form>
</body>
</html>
</iframe>
</div>
</div>
</body>
</html>
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
good
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): http://sourceforge.net/p/djproject/discussion/671154/thread/d7662f61 http://msdn.microsoft.com/en-us/ie/ff959805.aspx#_Compatibility_issues_with_1
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 26 Jun 2013
Copyright © CodeProject, 1999-2014
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