Skip to main content

How to make Chrome Packaged App that's trying to load realtime data model

A packaged app (Chrome App) cannot have less restrictive CSP (Content Security Policy) than the default CSP value. And it looks like the Google Drive Realtime API cannot be used in the Packaged app's without any hacks. Because the default packaged app Content Security Policy (CSP) value disallows the use of eval() or new Function(). However, a variety of library uses eval() and eval-like constructs such as new Fucntions() for performance optimization and for ease of expression. It will result in following error:

"EvalError when trying to load realtime data model"

Steps to resolve this issue:
  1. Load GAPI using a webview tag.
  2. Load Webview inside standalone localhost. Use a chrome socket.
  3. Handle your own OAuth flow and supply the token to the gapi auth client.
This way you can make your Chrome Packaged App to work with Google Drive Realtime API.

Comments

Popular posts from this blog

How to Build Realtime Collaborative Apps using Google Drive Realtime API

Google Drive lets users create Docs, Sheets, and Slides, collaborate on them in realtime. The Google Drive Realtime API provides collaboration as service for files in Google Drive via the use of Operational Transforms. Using Google Drive Realtime API, you can now easily build your own collaborative apps. Realtime API is based on the same collaboration technology used by Google Docs. Realtime Collaboration System: What Google Drive Realtime API does for you ? And what you have to do ? Realtime API handles everything for you like network communication, storage, conflict resolution, and other collaborative details: Functions to load and work with Realtime documents. Built-in collaborative objects (Strings, Lists and Maps) Also you can create your own custom collaborative objects. Events for detecting changes to the collaborative data model. A text binder to bind your collaborative objects to the DOM. Google Drive Realtime API provides all the tools you need to ...

Know Where to Place Chitika or Adsense Ads for Maximum Revenue

After you open your Adsense or Chitika account, don't simply copy and paste the ad code where you want in the website.Because there are many things that you need to consider while placing your ads in your website in order to effectively increase your revenue with Adsense or Chitika. The following are the main/basic mantra's to maximize your revenue. Choosing the Best Spots for your Ad Placement: The following picture shows you the best spots for placing ad units on your website. Place the ad directly below your blog post’s title and then followed by post content. Place the ad within the content of  your blog post. Place the ad directly below the post content and before the comments section. Customize your Ad: Login to your publisher account ,  Choose the appropriate ad format based on the spot for placing your ad unit. Select the color scheme which suits your blog content color scheme Get the Ad code and place in your website. Displaying...