javascript - Unable to load AWS SDK in Chrome App -


I'm calling around with a s3 bucket from javascript in a Chrome app, but I think that Blocking permissions from this

Let me know the AOS sdk: & lt; Include the local copy of script src = "assets / third-party / js / aws-sdk-2.0.22.min.js" & gt; & Lt; / Script & gt;

Otherwise I would: & lt; Script src = "get https://sdk.amazonaws.com/js/aws-sdk-2.0.22 .min.js" & gt; & Lt; / Script & gt; Denied script loading & lt; Script Path & gt; Because this infringes the following content security policy

The ADS SDK library fails: window.localStorage pack is not available in the app instead using Chrome.Storage.Local Please.

Am I out of luck? @mamjon, can you make a version of your SDK for Chrome Apps?

I just tested embedding the SDK in the sample app provided by Google and I successfully It was able to load and list objects in the AOMX S3 bucket, which is with Corus.

Warn me the window.localStorage , but note that this is an warning and if you have AWS CognitoIdentityCredentials are using and can only affect you (and can be worked around, so look at the end of this post).

AOS SDK: & lt; Script src = "A local copy of assets / third-party / JS / A VS-SDK-2.0.22. min. Must be included." JS "& gt; & Lt; / Script & gt;

That's right, you need to embed external content while typing the Chrome app because it is due to Chrome, which has strict rules, where the executable code comes from . How do I handle such resources, as well as how can not be embedded in it, I would recommend reading through the "section of the Chrome App Developer Guide" to learn about sandbox content.

Addendum: Window.localStorage

Edit : This solution will no longer be required after v2.0.23.

If you require AWS.CognitoIdentityCredentials , you can work around the window.localStorage problem by adding a script tag before the SDK :

  & lt; Script type = "text / javascript" src = "localStorage.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "a vs-sdk-2.0.23.money.js" & gt; & Lt; / Script & gt; The   

localStorage.js file will just redefine the localStorage and the following line will be:

  Window.localStorage = {};  

Note that depends on AWS.CognitoIdentityCredentials window.localStorage to recognize your secret identity when possible. The need to cache this ID should be less important with the applications of a page, and therefore it is ok to disable using the above technique. If you need to cash, you can see the API document to obtain the identity ID and store it later. You may also want to look at writing, which can allow you to refer to external content along with window.localStorage and, if necessary, use the CSP more comfortably.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -