Code Monkey home page Code Monkey logo

webview's Introduction

Webview

The <webview> element allows you to embed external content (e.g. a web page) in your Chrome app. The <iframe> element is disabled in Chrome apps, and this is its replacement. Contrary to an <iframe>, a Webview displays its content in a separate process. This provides extra security and its storage is isolated from the application. You may obtain the Webview's contentWindow and use this for bidirectional communication via postMessage.

A Dart Web Component or <x-webview> vs. <webview>

The <webview> element is the custom element (a web component in its own right) that is exposed to Chrome apps. However, it is not (yet) directly accessible in the Dart SDK. Therefore, the only way to interact with it at present is in javascript. That is where <x-webview> comes to the rescue! This package provides a strongly typed Dart web component wrapper element, <x-webview>, to expose the entire <webview> API in Dart to Chrome apps written in Dart.

Quick Start

Create an instance of <x-webview> following the standard practices of any web component:

  1. Add a component link from your application's html <head>:

  2. Add an element to your html <body>:

  3. Query the element from your dart <script> and make API calls:

	var webview = document.query('x-webview').xtag;
	webview.reload();

Explore the Examples:

  • Browser is a direct port of the Chrome App's javascript example.
  • Messaging illustrates bidirectional communication between a Chrome App and the embedded content of a Webview.

Further Reading:

For more insight as to how and why this component was developed, read this article.

Webview uses the MIT license as described in the LICENSE file, and semantic versioning.

webview's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.