Advertisement
Ludwiq

WP8.1 WebView problem

Oct 15th, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     "use strict";
  3.  
  4.     var webView;
  5.  
  6.     WinJS.UI.Pages.define("/pages/home/home.html", {
  7.         // This function is called whenever a user navigates to this page. It
  8.         // populates the page elements with the app's data.
  9.         ready: function (element, options) {
  10.             // TODO: Initialize the page here.
  11.             webView = document.getElementById("webview");
  12.             webView.navigate("http://www.google.com");
  13.  
  14.             webView.addEventListener("mswebviewdomcontentloaded", function () {
  15.                 var invScr = webView.invokeScriptAsync("eval", "document.getElementById('hplogo').style.backgroundColor = 'black';");
  16.                 Debug.write("Debug write");
  17.                 invScr.onerror = function () {
  18.                     Debug.write("Doesn't work");
  19.                 };
  20.                 invScr.oncomplete = function () {
  21.                     Debug.write("Works");
  22.                 };
  23.                 invScr.start();
  24.             });
  25.            
  26.         }
  27.     });
  28. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement