Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[URGENT]WebGL keyboards event not working when in a iframe

Discussion in 'Unity 5 Pre-order Beta' started by sluice, Feb 19, 2015.

  1. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    My WebGL build works fine when not in a iframe. Unfortunately, in a iframe all of my keyboard events are not working.

    I am currently using RC2, and check earlier builds (beta 14) and they now all have this issue.

    Any pointer to help me fix this asap, would be greatly appreciated.

    EDIT: also does it in Firefox.
     
    Last edited: Feb 19, 2015
    Gaurav-Gulati likes this.
  2. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Finally, here is how I made it work:

    In the html containing the canvas. I added this script:
    Code (csharp):
    1. $(window).on('load', function(){
    2. $(parent.document).find('iframe').focus();
    3. })
     
    Caio_Lib and Gaurav-Gulati like this.