{"id":2147,"date":"2022-08-30T15:22:26","date_gmt":"2022-08-30T15:22:26","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/03\/problem-about-google-chrome-app-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:22:26","modified_gmt":"2022-08-30T15:22:26","slug":"problem-about-google-chrome-app-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-google-chrome-app-collection-of-common-programming-errors\/","title":{"rendered":"problem about google-chrome-app-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4140cb9bb02b5d85c809eb9071b24d0f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2635541<br \/>\ngoogle-chrome google-chrome-extension google-chrome-app<br \/>\nI have written a chrome app to work at a kiosk system which gets started by the &#8211;app-id command-line switch. Unfortunately it is crashing a very few times (like twice a day) and the crashes are non-repeatable. Now i am trying to ensure it will get restarted after crash. So i wrote a batch script which checks if chrome is running and will restart the app if it&#8217;s not.My problem is that if the app crashes it will become deactivated on chrome, so when the shortcut gets called, it only opens a brows<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ac67ec985b6fc9a053238093201e02f8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nddumont<br \/>\ngoogle-chrome-app<br \/>\n2 issues here really, one that I&#8217;ve encountered before in another questions: Using dojo 1.8 in a packaged app (uncaught unload is not available in packaged apps)And another that has to do with fetching dojo template resources (html files) from inside the packaged app from a sandboxed frame.Let&#8217;s start with 1: As an update to the previous question link, the current status is that using the dojo parser in a sandboxed frame will throw an error and break dojo due to an exception thrown from an addEv<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8e68c462b98d95924844d341ff3ff4d6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDamian<br \/>\njquery google-chrome-app chrome-packaged-app<br \/>\nUsing jQuery 1.10.2 and jQuery Mobile 1.3.2 I am trying to create a chrome packaged app with the following simple html&#8230;&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt;&lt;div data-role=&#8221;page&#8221;&gt;&lt;script async src=&#8221;events.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;&lt;\/div&gt; &lt;\/body&gt; &lt;\/html&gt;There are two problems. The first is that jQuery will intercept the script tag loading events.js and makes the call xhr.open( s.type, s.url, s.async ); however s.async is false. Chrome packa<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a7c213efc14dd5507dde59fc5c4a061e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBill Gradwohl<br \/>\ndebugging google-chrome-app<br \/>\nI&#8217;m converting a standard browser based app that&#8217;s working fine to a chrome-app. Once the page loads up, it has already hit an error &#8211; Uncaught TypeError: Cannot call method &#8216;appendChild&#8217; of null. This occurs after several hundred lines of JS have done their job but its the first time the code makes a reference to the document object, specifically document.getElementById(&#8216;mainDiv&#8217;).appendChild(&#8230;).I can clearly see the div with the id=&#8221;mainDiv&#8221; in the debuggers elements tab. Yet, document.getE<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/148f9543658acb479a2cad17998d46c7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBlynn<br \/>\njavascript google-chrome-extension google-chrome-app<br \/>\nI&#8217;m getting this error &#8220;Uncaught TypeError: Cannot call method &#8216;setBadgeText&#8217; of undefined &#8220;This is my code below:This used to work in Chrome 27.0, but now with Chrome 29.0 it seems to have stopped functioning. I&#8217;m not sure if it&#8217;s this or the.. manifest.json file which loads this in the background.var DOCLIST_SCOPE = &#8216;https:\/\/docs.google.com\/feeds&#8217;;var DOCLIST_FEED = DOCLIST_SCOPE + &#8216;\/default\/private\/full\/&#8217;;var docs = []; \/\/ In memory cache for the user&#8217;s entire doclist.var refreshRate = local<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3346aa4b04e9c715ecf8642db198b3fe?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMihai Parparita<br \/>\njavascript google-chrome google-chrome-extension eval google-chrome-app<br \/>\nI would like to create a package app chrome extension to allow the user to write and execute javascript code (like a javascript console).I would like to use the eval() function to execute the JS code.The classic javascript eval function throws an error when it&#8217;s called from a chrome extension:Uncaught Error: Code generation from strings disallowed for this context To use eval in a chrome extension people need to use a sandbox, but when I write the sandbox in the manifest I get this error:There w<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1acb47a728c7c8a186647dcfaa2b5865?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAshleysBrain<br \/>\njavascript sockets google-chrome google-chrome-extension google-chrome-app<br \/>\nI&#8217;m trying to get UDP sockets working for a packaged app using Chrome Canary (currently version 25). I am pretty confused by the fact the UDP example here conflicts with the reference documentation here.The official example uses this line:chrome.socket.create(&#8216;udp&#8217;, &#8216;127.0.0.1&#8217;, 1337, { onEvent: handleDataEvent }, &#8230;In Canary using this line results in the error:Uncaught Error: Invocation of form socket.create(string, string,integer, object, function) doesn&#8217;t match definitionsocket.create(stri<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/13b41b2620da0b1e630715e0c91a0b03?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJosh Lee<br \/>\ngoogle-chrome-app mathjax content-security-policy<br \/>\nI am trying to use MathJax in Chrome Packaged app. It is not loading at all giving the following error :Uncaught EvalError: Refused to evaluate a string as JavaScript because &#8216;unsafe-eval&#8217; is not an allowed source of script in the following Content Security Policy directive: &#8220;default-src &#8216;self&#8217; chrome-extension-resource:&#8221;.How can I make it work?EDITIT is showing this line to be the problem in the libraryvar CONSTRUCTOR = function () {return new Function (&#8220;return arguments.callee.Init.call(this,a<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c916d92c098426d84778a7910cc32b39?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRob W<br \/>\njavascript web-sql google-chrome-app<br \/>\nI am trying to use openDatabase with a Google Chrome app but the following error is displayed:Uncaught ReferenceError: openDatabase is not defined I also added permissions (unlimitedStorage) in manifest.json.<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/75Sll.png?s=32&amp;g=1\" \/><br \/>\nGarrett Innovations<br \/>\njson google-chrome-app<br \/>\nI am working on a chrome app and its basically done, however I am adding code to my customer&#8217;s website to have it determine if the app is installed on chrome or not.In order to do this I need to check for a file &#8220;manifest.json&#8221; is available for the app to determine if its installed or not.I am using the below code that I got from another posted question on here:function detectChromeExtension(extensionId, accesibleResource, callback){if (typeof(chrome) !== &#8216;undefined&#8217;){var xmlHttp = new XMLHttpRe<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3346aa4b04e9c715ecf8642db198b3fe?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMihai Parparita<br \/>\ngoogle-chrome google-chrome-extension google-chrome-app<br \/>\nI&#8217;m trying to use the new Socket API for Chrome extensions, and I&#8217;m encountering a confusing error. The manifest for my sample app looks like this:{&#8220;name&#8221;:&#8221;Yet Another Socket App&#8221;,&#8221;version&#8221;:&#8221;0.0.1&#8243;,&#8221;manifest_version&#8221;:2,&#8221;permissions&#8221;:[&#8220;experimental&#8221;, &#8220;socket&#8221;],&#8221;app&#8221;:{&#8220;launch&#8221;:{&#8220;local_path&#8221;:&#8221;index.html&#8221;}} }The app is loading (i.e., no error alerts), but a warning appears beneath its entry in chrome:\/\/extensions: &#8216;socket&#8217; is not allowed for specified package type (theme, app, etc.).Notes: index.ht<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/70bd5b989402b7086dfe9c317637ac22?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJrop<br \/>\nfile command-line-arguments google-chrome-app<br \/>\nI&#8217;m trying to write a Chrome packaged app that will eventually accept files as arguments from the command line, but I can&#8217;t figure out how to make it work. Here&#8217;s what I&#8217;m doing:manifest.json:&#8230; &#8220;file_handlers&#8221; : {&#8220;text&#8221; : {&#8220;types&#8221; : [ &#8220;*&#8221; ],&#8221;title&#8221; : &#8220;File Opener&#8221;} }, &#8230;my-background-page.js:chrome.app.runtime.onLaunched.addListener(function (launchData) {chrome.app.window.create(&#8216;my-file.html&#8217;, { &#8230; }, function (win) {win.contentWindow.launchData = launchData;}); });(I expect launchData to<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3346aa4b04e9c715ecf8642db198b3fe?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMihai Parparita<br \/>\ngoogle-chrome google-chrome-extension google-chrome-app<br \/>\nI am following the google chrome web app development on http:\/\/developer.chrome.com\/trunk\/apps\/first_app.html and the web app is not launching. when i click on the app icon on the page it closes the tab. I have downloaded the sample apps and plugins from github but they too are not working when i look at the console i get this error, please not i have enabled experimental API&#8217;s in chrome:\/\/flags.Uncaught TypeError: Cannot read property &#8216;onLaunched&#8217; of undefined I have updated my chrome browser t<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/116f8c31bdc6f198b0093561eea46ecd?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nMister F<br \/>\njavascript google-chrome-app<br \/>\nI&#8217;m getting this weird error and I haven&#8217;t seen it anywhere else. When I try to call chrome.identity.getAuthToken, I get back undefined (which means an error occurred) and a chrome.runtime.lastError that says Oauth2: bad client id NON_NATIVE. I have no idea what that means (I put my Oauth client id into the manifest.json just like in the examples) and I haven&#8217;t seen this error anywhere else.<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b590f0fb3aba34aee093cfa1406eac0b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nKinlan<br \/>\njavascript html5 google-chrome-app<br \/>\nGiven that Chrome&#8217;s Client Security Policy for packaged apps, in contrast to hosted ones, does NOT allow either inline script or inline events, requiring all JavaScript to be in separate files, there&#8217;s a bit of an issue when it comes to datetime controls here.countform.html:&lt;!DOCTYPE html&gt; &lt;html lang=&#8221;en&#8221;&gt;&lt;head&gt;&lt;title&gt;Countdown form&lt;\/title&gt;&lt;script type=&#8221;text\/javascript&#8221; src=&#8221;countform.js&#8221;&gt;&lt;\/script&gt;&lt;\/head&gt;&lt;body&gt;&lt;form id=&#8221;countform&#8221; method=&#8221;<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2014-01-03 22:30:13. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>user2635541 google-chrome google-chrome-extension google-chrome-app I have written a chrome app to work at a kiosk system which gets started by the &#8211;app-id command-line switch. Unfortunately it is crashing a very few times (like twice a day) and the crashes are non-repeatable. Now i am trying to ensure it will get restarted after crash. So i [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2147","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2147"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2147\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}