Though Chrome Apps use the web platform, some web features have been disabled or else are used in a different way. Mainly this is to avoid security issues and to improve programming practices. Below is a summary of the disabled features of the web platform and potential work-arounds:
Disabled | Work-around |
---|---|
alert | Use a custom lightbox/popup. |
Browser chrome APIs | N/A. |
confirm | Use a custom lightbox/popup. |
document.cookie | Packaged app pages are not rendered on the server, so there is no need to use these. |
document.close | N/A. |
document.open | N/A. |
document.write | Use document.createElement. |
External resources | Use the webview tag for iframes. See Embed Content and Webview Tag API. Video and audio are allowed to have non-local URLs. |
Flash | Use HTML5 Platform. |
Form submission | Use JavaScript to process form content (listen for submit event, process data locally first before sending to server). |
javascript: urls | You cannot use bookmarklets for inline javascript on anchors. Use the traditional click handler instead. |
localStorage | Use IndexedDB or the Storage API (which also syncs to the cloud). |
Navigation | Links open up with the system web browser. window.history and window.location are disabled. |
Non-sandboxed plugins | N/A. |
showModalDialog | Use a custom lightbox/popup. |
Synchronous XMLHttpRequest | Use async-only XMLHttpRequest : Getting Rid of Synchrounous XXRs. |
User Text selection | By default, users can no longer select text like they can on a web page. To make areas of the app's text selectable, apply the CSS style, -webkit-user-select: text; . |
webSql | Use IndexedDB or Filesystem API. |