Skip to content Skip to sidebar Skip to footer

Google Closure And Chrome Packaged Apps: Compatibility?

I am using Google Closure and and I am trying to make a Chrome packaged app. My call to goog.require causes an error: Uncaught document.write() is not available in packaged apps.

Solution 1:

Closure Dev Mode & Chrome Packaged App -- "document.write() is not available in the sandbox of packaged apps"

As long as you run it uncompiled or don't compile with advanced compilation you have to re write the doc.write with document.createElement("script");

So replace te doc.write line with:

  var script = document.createElement('script');
  script.src = src;
  script.type = 'text/javascript';
  goog.global.document.getElementsByTagName("head")[0].appendChild(script);
  return true;

Advance compiled code should not need this as it puts all the used code together in one file.


Post a Comment for "Google Closure And Chrome Packaged Apps: Compatibility?"