Zebble
  • About Zebble
  • Compare
  • Documentation
  • Themes
  • Plug-ins
  • Contact Us

    • What is Zebble?
    • Structure of a Zebble solution
    • Zebble Designer (UWP)
    • Installing - Introduction
    • Change log
    • Introduction
    • ViewModel development
    • VM.EXE
    • View development
    • Dialogs
    • Lists and Collections
    • Tips and shortcuts
    • List views
    • ViewModel testing
    • Automatic Views
    • View development process
    • Hello World - Core Concepts
    • Layout: Sizing & Positioning
    • Event handling
    • Navigation
    • Alerts, Dialog, Prompt and toast
    • View lifecycle
    • Managing Files & Resources
    • Config & Debugging
    • Forms
    • Page templates
    • Device API
    • Animations
    • Web Api - Part 1 (reading data)
    • Web Api - Part 2 (post and delete)
    • Web Api - Part 3 (server vs client domain model)
    • Gesture events
    • View class
    • Zebble Markup (.zbl files)
    • Data Binding and MVVM
    • Stack class
    • Sizing and positioning
    • Layout examples
    • ScrollView class
    • Page class
    • Styling in Zebble
    • CSS property mapping to Zebble
    • Supported selectors
    • Zebble CSS: Under the hood
    • Inline styling
    • CSS real-time updates
    • Dynamic expressions in CSS
    • Gradient background colours
    • CSS Pseudo-classes support
    • Using Bold and Light Fonts in Zebble
    • Rotation in Zebble
    • Using custom fonts in Zebble
    • Flashing on tap using AutoFlash
    • Button
    • Carousel class
    • Checkbox class
    • DatePicker
    • Drawing class
    • FilePicker class
    • Grid class
    • IconButton class
    • ImageView
    • ItemPicker class
    • ListView & Grid classes
    • OptionsList
    • SearchInput class
    • Slider class
    • Switch class
    • Tabs Class
    • TextInput class
    • TextView
    • TimePicker
    • TreeView
    • Waiting Indicator
    • WebView class (displaying html)
    • C# Methods and Properties Of UI Components
    • Nav.Forward() vs Nav.Go()
    • Passing parameters to the destination page
    • Going Back
    • Showing Popup pages
    • Waiting class
    • Hardware Back button (e.g. Android)
    • NavigationBar class
    • Tabs class
    • Caching (pages)
    • Navigation without event handler
    • Use the Windows version
    • Logging messages for Debugging
    • Debugging Zebble/Plugin
    • Exception handling in Zebble
    • Debugging layout and styles
    • Zebble Device API
    • Device.Screen and orientation (landscape | portrait)
    • Code that should run on a specific platform
    • Using Lamp (aka Flash, LED and Torch)
    • Using Compass (Smooth compass)
    • Using Accelerometer (device angle)
    • Using Gyroscope (device motion speed)
    • How to Vibrate the device?
    • Launching the device browser
    • Finding device model and manufacturer
    • Responding to System events
    • Handling device shake event
    • Permissions
    • Permissions declaration (manifest files)
    • Sharing
    • Prompt for rating the app
    • Finding if Internet connection is available
    • Device messaging (Make a phone call, send SMS or Email)
    • Showing a local notification
    • Copying to Clipboard
    • Accessing device contacts
    • Reading and writing into Gallery (albums)
    • Playing & Recording Audio
    • Cache and temp files and folders
    • C# async / await
    • Understanding Zebble Threading
    • Debugging - the StackTrace problem
    • Not awaiting (running in parallel)
    • Timer (interval / scheduled running)
    • Post-render changes to the UI (dynamic)
    • Introduction of Geo location
    • Map & Location Services
    • Launch directions to a location (external)
    • Getting current Location
    • Tracking user location
    • Device.Media: Taking and picking photos
    • Playing an audio file
    • VideoPlayer class
    • Augmented reality
    • Recording audio
    • Virtual Reality
    • Speech Recognition
    • Recording or picking video
    • Playing remote videos in iOS
    • Text to speech
    • Introduction to the importance of Mobile Testing
    • Why and what to test
    • Testing mobile apps on different devices
    • Testing mobile apps
    • Xamarin Profiler
    • Performance optimization
    • Moving a view to another container at run-time
    • Attaching custom data (tag) to objects
    • Saving a view as image
    • Naming best practices
    • Fastest way to update your nuget package
    • Tips for Clean and Brief code
    • Splash screen and icon generation
    • Advice for passing Approval
    • Options for iOS app distribution
    • Test Release (internal and UAT)
    • Application Icons in IOS
    • Submitting to App Store
    • Releasing to App Store
    • Crash reporting
    • Optimized Release Build
    • Android - Generating an APK for manual installation
    • Payment (subscriptions & in-app purchases)
    • Introduction to push notifications
    • Registration process (App)
    • Push notification setup - iOS
    • Push notification setup - Android
    • Push notification setup - Windows
    • Sending a push message from the web app
    • Introduction
    • Connecting Zebble to Web API
    • Installation
    • Creating an API class
    • GET APIs
    • Calling a GET API (in the mobile app)
    • POST, PUT, PATCH and DELETE APIs
    • Domain Model
    • Web API and Authentication
    • Versioning
    • Uniquely identifying installations (token)
    • Settings file: config.xml
    • Standard Zebble settings
    • Login/Register with Facebook
    • Creating a composite component / plugin
    • Creating a Zebble component using Html and Javascript
    • CustomRenderedView: Third-party native components / plugins
    • Mapbox
    • Naming considerations
    • Random problems?
    • Display Keyboard for Visual Studio Android Emulator
    • iOS goes mad?
    • Configuring a Windows phone for ad-hoc testing
    • Fixing Error DEP0001 : Unexpected Error: -2147009287 while deploying Windows UWP app on device
    • Fixing Error DEP0001 : Unexpected Error: -1988945906 while deploying Windows UWP app on device
    • Unable tp Connect to the Mac agent from Visual Studio
    • Can't connect to the Mac agent from Visual Studio?
    • Choosing the CPU architecture
    • Zebble CLI
    • How to add a Device API to Zebble source?
    • About Automated UI testing
    • What should we test in mobile applications?
    • Creating an Automated UI Test in Zebble



WebView class (displaying html)


A WebView component (sub-class of View) allows you to render a piece of Html or a whole URL in an embedded browser component.

To use this component, install the Zebble.WebView nuget package. 
It's open source and available on GitHub. Also we welcome any contributions to enhace it.

 

 

To show an external URL, use:

<WebView Url="http://www.Google.com" />

To show some html directly, use:

<WebView Html="@GetHtml...()" />The value of HTML can be a full html page (wrapped in a <html>...</html> tag), or a partial html piece such as  "<b>something</b>".

In the above example GetHtml() is a method in the code behind. Of course the data can come from the database, your domain objects, etc. 

To show a html file from your Resources folder, use:

<WebView Url="MyPages/SomePage.html" />The above example assumes you have a file named SomePage.html under App.UI\Resources\MyPages folder.

Javascript, Image and CSS Files

In the HTML page, you can reference Javascript, Image or CSS files in your Resources folder.
You can also reference web-hosted resources by specifying the full url. For example:

...
<script type="text/javascript" src="MyPages/MyScript.js"></script>
<script type="text/javascript" src="http://mywebsite.com/MyScript.js"></script>
...
<img src="Images/Icons/Hello.png">

Communication between Javascript and Zebble code

The EvaluateJavascript() method allows you to run some Javascript code on the rendered page, and then get the value of its evaluation back.

MyWebView.EvaluateJavascript("$('.some-object').attr('value')");To send a message from the web page to the native app, you can use the following technique:

- From the web page context, navigate to a psudo url, such as my-command:my-param. 

- In the C# code, handle the BrowserNavigating event and get the message to process.

<a href="#my-command_param1">Foo with param1</a>
<a href="#my-command_param2">Foo with param2</a>

<a href="#another-command_param3">Bar with param3</a>An in the C# code:

MyWebView.BrowserNavigating.Handle(e => {
        if (e.Url.StartsWith("#my-command_")) DoMyThing(e.Url.TrimStart("#my-command_"));
       else if (e.Url.StartsWith("#another-command_")) DoAnotherThing(e.Url.TrimStart("#another-command_"));
});

Important Tips

  • When generating a full page html, remember to set the viewport meta tag, otherwise the content will be rendered at the top left corner in UWP.
    <head>
        <meta name="viewport" content="width=device-width", initial-scale="1">
    </head>
  • If using a local html file, it should be a valid xhtml. For example all tags should be closed and lowercase.
  • UWP does not support loading html content from local storage. However, Zebble solves that limitation. This is how it works:
    1. It reads the HTML file and parses the html.
    2. It then looks for <script> and <link css> tags which reference a local file.
    3. It will then load those files and copies their content as embedded code inside the html page.
    4. It will then load the combined html on the native device browser component.

Value:

The Value property determines the HTML content of current page.

Events:

  • on-BrowserNavigated: Raised when browser completed showing the content.
  • on-BrowserNavigating: Raised when browser started to showing the content.
  • on-LoadFinished: Raised when browser completed showing the content.
  • on-LoadingError: Raised when an error raised, when browser wants to show content.
  • on-SourceChanged: Raised when the address of the browser content is changed.



‹
Zebble is a product of Geeks Ltd , a software house based in London, UK. All rights are reserved.

Telephone: +44 (0)845 643 6229

Email: hello@zebble.net

Address: 66a London Road, Morden

Greater London, United Kingdom, SM4 5BE

Privacy Statement
Terms & Conditions
Contact Us