Application.ExternalCall causing problems when WebGL is packaged into a Chrome App

I almost have everything working when packaging up the WebGL build into a chrome app but when I attempt to play a youtube video by triggering an external javascript call I get the following error.

Based on this documentation (Content Security Policy  |  Apps  |  Chrome for Developers) it seems this is blocked for security reasons.

  • You can’t use string-to-JavaScript methods like eval() and new Function().

Does anyone have any suggestions on how I can trigger javascript functions from within Unity. I’m assuming Application.ExternalCall needs to use eval?

The reason we play our video in youtube and not in unity is because we were having issues on specific devices when attempting to create the video texture in WebGL and so far it been a big improvement in terms of app stability.

Hello crushforth.

Consider using jslib plugin instead, this way you should not encounter any security restrictions: http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

1 Like

Thanks. I’ll get on implementing this.