Urgent: Crash in Internet Explorer when trying to hide the experience

(9 posts) (3 voices)
  • Started 11 months ago by Octarina
  • Latest reply from Octarina
  1. Octarina

    member
    Joined: May '13
    Posts: 43

    Hello

    I have an experience about to go online and we have discovered a crash (Internet Explorer only) when trying to hide the 3D experience (in order to have a popup open over it).

    I have isolated the problem to this case:

    Simply call:

    vkWebManager* wman = vkWebManager::InstancePtr();
    vkString strCommand(vkString("HideWindow()"));
    wman.ExecuteScript(strCommand, "JavaScript");

    In the javascript, hide the <div> containing the experience:

    function HideWindow() {
      // Hide 3DVIA Studio experience
      var eltStudio = document.getElementById('3dvia-player-block');
      eltStudio.style.display = 'none';
    }

    The result is a crash, only in Internet Explorer, with my debugger saying "Access violation in ieframe.dll".

    The seems to stem from the Studio experience, as using a button on the web-page itself successfully hides/unhides the experience. The problem is only when the function is called from 3DVIA Studio.

    I have attached the simplest possible project reproducing this bug, with a sample html page. Try the html buttons to see that it works. Then try the button in the 3D experience to watch IE crash.

    For info, this does not happen in Firefox or Chrome.

    Your help is greatly appreciated.

    Attachments

    1. TestCrash.zip (134.7 KB, 2 downloads) 11 months old
    WARNING: Files uploaded in the forums are not monitored by 3DVIA and therefore might contain content that is malicious or offensive. Download at your own risk
    Posted 11 months ago #
  2. tixouille

    Studio/Virtools Guru
    Joined: Dec '06
    Posts: 7

    Hi,

    Thanks for the feedback and precise scenario!
    We are investigating...

    Until a new update of the Player is released, you can use this workaround : actually the crash occurs only if the Player has the focus when the "hide" is called. A workaround is to set the focus to another DOM element of your page (ideally not a parent element in which the player is contained), for example using JavaScript "focus()" function, and then hide the Player.

    Hope this helps, and sorry for the annoyance.
    Regards

    Posted 11 months ago #
  3. tomy

    Honorary Community Marshall
    Joined: May '08
    Posts: 700

    Try setting the CSS visibility to hidden

    Posted 11 months ago #
  4. Octarina

    member
    Joined: May '13
    Posts: 43

    Hello

    Thank you for the quick response. Unfortunately, neither solution seems to work. Adding this to my javascript:

    var eltOther = document.getElementById('3dvia-player-dummy');
    eltOther.focus();

    .... still results in a crash. Using "visibility" also has no effect.

    If I delay the hide process a little, that is, start a timer in the function called by Studio, which then calls another function which actually does the hide, there is no crash.

    var timeVar;
    
    function HideWindow() {
      timerVar = setInterval(function(){DoHideAction()},100);
    }
    
    function DoHideAction()
    {
      var eltOther = document.getElementById('3dvia-player-dummy');
      eltOther.focus();
    
      // Hide 3DVIA Studio experience
      var eltStudio = document.getElementById('3dvia-player-block');
      eltStudio.style.visibility = 'hidden';
    
    }
    
    function ShowWindow() {
      var eltOther = document.getElementById('3dvia-player-dummy');
      eltOther.focus();
    
      // Hide 3DVIA Studio experience
      var eltStudio = document.getElementById('3dvia-player-block');
      eltStudio.style.visibility = 'visible';
    }

    However, when I try to un-hide the experience, there is still a crash (note, in the above example, and also if I use the timer approach).

    Thanks

    Posted 11 months ago #
  5. tomy

    Honorary Community Marshall
    Joined: May '08
    Posts: 700

    Is it possible to cover the player with a div using Quirksmode's findPos function, and finding the parent div's offsetWidth and offsetHeight properties?
    Something like:
    function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
    do {
    curleft += obj.offsetLeft;
    curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
    return [curleft,curtop];
    }
    }
    document.getElementById("player").innerHTML = "<div id='playercover' style='position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;background-color:white;layer-background-color:white;'></div>" + document.getElementById("player").innerHTML;
    document.getElementById('playercover').top = findPos('player')[1] + "px";
    document.getElementById('playercover').left = findPos('player')[0] + "px";
    Thanks to the function at http://www.quirksmode.org/js/findpos.html

    Posted 11 months ago #
  6. tomy

    Honorary Community Marshall
    Joined: May '08
    Posts: 700

    EDIT: Forgot that will change the player settings and I need to add the style attribute! Try this:
    function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
    do {
    curleft += obj.offsetLeft;
    curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
    return [curleft,curtop];
    }
    }
    document.getElementById("player").innerHTML += "<div id='playercover' style='position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;background-color:white;layer-background-color:white;'></div>";
    document.getElementById('playercover').style.top = findPos('player')[1] + "px";
    document.getElementById('playercover').style.left = findPos('player')[0] + "px";
    A good night's rest can be the best solution to a javascript problem.

    Posted 11 months ago #
  7. Octarina

    member
    Joined: May '13
    Posts: 43

    Hi Tomy

    Thanks for the advice, although for me IE still crashes as soon as I try to modify the innerHTML field.

    Also, the reason why I am trying to hide the experience is that in IE (only), a popup using jquery shows up underneath the experience, whereas the popup should completely cover it.

    Posted 10 months ago #
  8. tixouille

    Studio/Virtools Guru
    Joined: Dec '06
    Posts: 7

    Another workaround idea until a fix is found could be to "hide" the player in an "offscreen" position: you actually don't hide it in HTML terms, but it is put offscreen. That's actually the trick used by 3dvia.com when the menu pops over a Player:

    For example using jQuery ("player" being the id you pass to the embedHere/embedAt helpers functions):
    $('#player').css('margin-left', -5000);

    Hope this helps

    Posted 10 months ago #
  9. Octarina

    member
    Joined: May '13
    Posts: 43

    Right, I'm officially floored!

    It works perfectly - a bit of a hack, but as long as it works!

    Thank you, thank you, thank you!

    Posted 10 months ago #

Reply

You must log in to post.