{"id":6167,"date":"2015-08-28T16:59:17","date_gmt":"2015-08-28T07:59:17","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6167"},"modified":"2015-08-28T16:59:17","modified_gmt":"2015-08-28T07:59:17","slug":"windows-10uwp%e3%82%a2%e3%83%97%e3%83%aa%e3%81%a7webview%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6167","title":{"rendered":"[Windows 10]UWP\u30a2\u30d7\u30ea\u3067WebView\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u307f\u305f\u3002"},"content":{"rendered":"<p><a href=\"http:\/\/blogs.windows.com\/msedgedev\/\" title=\"Microsoft Edge Dev Blog\" target=\"_blank\">Microsoft Edge Dev Blog<\/a>\u306b\u300c<a href=\"http:\/\/blogs.windows.com\/msedgedev\/2015\/08\/27\/creating-your-own-browser-with-html-and-javascript\/\" title=\"Creating your own browser with HTML and JavaScript | Microsoft Edge Dev Blog\" target=\"_blank\">Creating your own browser with HTML and JavaScript<\/a>\u300d\u3068\u3044\u3046\u8a18\u4e8b\u304c\u30a2\u30c3\u30d7\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3092\u898b\u308b\u3068\u3001\u4f55\u3084\u3089<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/dn301831.aspx\" title=\"webview element | webview object - Windows app development\" target=\"_blank\">WebView<\/a>\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3068\u3084\u3089\u3092\u4f7f\u3048\u3070\u3001\u30e6\u30cb\u30d0\u30fc\u30b5\u30eb Windows \u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 (UWP) \u30a2\u30d7\u30ea\u3067Microsoft Edge\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u30a8\u30f3\u30b8\u30f3\u300c<span style=\"color: #ff0000; font-weight: bold;\">EdgeHTML<\/span>\u300d\u3092\u4f7f\u3063\u3066Web\u30da\u30fc\u30b8\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>\u3053\u308c\u306f\u4e2d\u3005\u9762\u767d\u305d\u3046\uff01<br \/>\n\u30fb\u30fb\u30fb\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3055\u3063\u305d\u304f\u691c\u8a3c\u7528\u306e\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h4 class=\"style4a\">\u958b\u767a\u74b0\u5883<\/h4>\n<ul>\n<li>Windows 10 Pro x64<\/li>\n<li>Visual Studio Community 2015<\/li>\n<li>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff1a\u7a7a\u767d\u306e\u30a2\u30d7\u30ea (\u30e6\u30cb\u30d0\u30fc\u30b5\u30eb Windows) JavaScript<\/li>\n<\/ul>\n<h4 class=\"style4a\">\u30b3\u30fc\u30c9<\/h4>\n<p><strong>default.html<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=utf-8&quot;\/&gt;\r\n    &lt;meta charset=&quot;utf-8&quot; \/&gt;\r\n    &lt;title&gt;App1&lt;\/title&gt;\r\n\r\n    &lt;!-- WinJS \u53c2\u7167 --&gt;\r\n    &lt;link href=&quot;WinJS\/css\/ui-dark.css&quot; rel=&quot;stylesheet&quot; \/&gt;\r\n    &lt;script src=&quot;WinJS\/js\/base.js&quot;&gt;&lt;\/script&gt;\r\n    &lt;script src=&quot;WinJS\/js\/ui.js&quot;&gt;&lt;\/script&gt;\r\n\r\n    &lt;!-- App1 \u53c2\u7167 --&gt;\r\n    &lt;link href=&quot;\/css\/default.css&quot; rel=&quot;stylesheet&quot; \/&gt;\r\n    &lt;script src=&quot;\/js\/default.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body class=&quot;win-type-body&quot;&gt;\r\n    &lt;input id=&quot;url&quot; type=&quot;url&quot; size=&quot;40&quot; value=&quot;http:\/\/www.useragentstring.com\/&quot; \/&gt;\r\n    &lt;button id=&quot;btnGo&quot;&gt;GO&lt;\/button&gt;\r\n    &lt;button id=&quot;btnFullscreen&quot;&gt;FullScreen&lt;\/button&gt;\r\n    &lt;x-ms-webview id=&quot;webview&quot; src=&quot;http:\/\/www.yahoo.co.jp\/&quot;&gt;&lt;\/x-ms-webview&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><strong>default.css<\/strong><\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">#webview {\r\n    width: 100%;\r\n    height: 100%;\r\n}<\/pre>\n<p><strong>default.js<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">(function () {\r\n    &quot;use strict&quot;;\r\n    \r\n    var webviewControl;\r\n    var app = WinJS.Application;\r\n    var activation = Windows.ApplicationModel.Activation;\r\n\r\n    app.onactivated = function (args) {\r\n        if (args.detail.kind === activation.ActivationKind.launch) {\r\n            if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {\r\n                \/\/TODO: \u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u65b0\u3057\u304f\u8d77\u52d5\u3057\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u521d\u671f\u5316\u3057\u307e\u3059\u3002\r\n                webviewControl = document.getElementById(&quot;webview&quot;);\r\n                document.getElementById(&quot;btnGo&quot;).addEventListener(&quot;click&quot;, goToUrl, false);\r\n                document.getElementById(&quot;btnFullscreen&quot;).addEventListener(&quot;click&quot;, toggleFullscreen, false);\r\n            } else {\r\n                \/\/ TODO: \u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u4e2d\u65ad\u3055\u308c\u3066\u304b\u3089\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002\r\n                \/\/ \u30b9\u30e0\u30fc\u30ba\u306a\u30e6\u30fc\u30b6\u30fc \u30a8\u30af\u30b9\u30da\u30ea\u30a8\u30f3\u30b9\u3068\u306a\u308b\u3088\u3046\u3001\u3053\u3053\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u72b6\u614b\u3092\u5fa9\u5143\u3057\u3001\u30a2\u30d7\u30ea\u304c\u505c\u6b62\u3057\u305f\u3088\u3046\u306b\u306f\u898b\u3048\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3059\u3002\r\n            }\r\n            args.setPromise(WinJS.UI.processAll());\r\n        }\r\n    };\r\n\r\n    app.oncheckpoint = function (args) {\r\n        \/\/TODO: \u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u4e2d\u65ad\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u4e2d\u65ad\u4e2d\u306b\u7dad\u6301\u3059\u308b\u5fc5\u8981\u306e\u3042\u308b\u72b6\u614b\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002\r\n        \/\/ WinJS.Application.sessionState \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u4e2d\u65ad\u306e\u9593\u81ea\u52d5\u7684\u306b\u4fdd\u5b58\u3055\u308c\u3001\u5fa9\u5143\u3055\u308c\u307e\u3059\u3002\r\n        \/\/\u3054\u4f7f\u7528\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4e2d\u65ad\u3059\u308b\u524d\u306b\u975e\u540c\u671f\u306e\u64cd\u4f5c\u3092\u5b8c\u4e86\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f\u3001args.setPromise() \u3092\u547c\u3073\u51fa\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n    };\r\n\r\n    app.start();\r\n\r\n    function goToUrl() {\r\n        try{\r\n            var url = document.getElementById(&quot;url&quot;).value;\r\n            webviewControl.navigate(url);\r\n        } catch (e) {\r\n            console.log(e);\r\n        }\r\n    }\r\n\r\n    function toggleFullscreen() {\r\n        var view = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();\r\n        if (view.isFullScreen == true) {\r\n            view.exitFullScreenMode();\r\n        } else {\r\n            view.tryEnterFullScreenMode();\r\n        }\r\n    }\r\n})();<\/pre>\n<p>\u4f5c\u3063\u305f\u3068\u3044\u3063\u3066\u3082\u3001\u305d\u3053\u306fUWP\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u305f\u3053\u3068\u306e\u306a\u3044\u30c9\u7d20\u4eba\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b<span style=\"color: #ff0000; font-weight: bold;\">x-ms-webview<\/span>\u8981\u7d20\u3092\u3061\u3087\u3053\u3063\u3068\u8ffd\u52a0\u3057\u305f\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u3082\u4e00\u5fdc\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b\u3061\u3083\u3093\u3068\u52d5\u4f5c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\nUser agent\u3082\u3061\u3083\u3093\u3068Edge(EdgeHTML)\u306e\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/UWPApp_Using_WebViewControl_01.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/UWPApp_Using_WebViewControl_01.gif\" alt=\"UWPApp_Using_WebViewControl_01\" width=\"950\" height=\"691\" class=\"alignnone size-full wp-image-6168\" \/><\/a><\/p>\n<p>\u8a73\u3057\u304f\u306f\u8abf\u3079\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u304c\u3001WebView\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306fiframe\u3067\u306f\u51fa\u6765\u306a\u3044\u8272\u3005\u306a\u3053\u3068\u304c\u3067\u304d\u308b\u305d\u3046\u3067\u3001\u305d\u308c\u304c\u3053\u3046\u3057\u3066\u7c21\u5358\u306b\u5229\u7528\u3067\u304d\u308b\u306e\u306f\u3001\u3068\u3066\u3082\u4fbf\u5229\u306a\u3053\u3068\u3060\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n(HTML + JavaScript \u3068\u3044\u3046\u306e\u3082\u624b\u8efd\u3067\u826f\u3044\u3067\u3059\u306d\uff01)<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001Edge Dev Blog\u306e\u8a18\u4e8b\u306b\u3082\u8f09\u3063\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001<a href=\"https:\/\/www.microsoft.com\/ja-jp\/store\/apps\/javascript-browser\/9nblggh1z7vx\" title=\"JavaScript Browser - Microsoft \u30b9\u30c8\u30a2\u306e Windows \u30a2\u30d7\u30ea\" target=\"_blank\">\u30b5\u30f3\u30d7\u30eb\u30a2\u30d7\u30ea<\/a>\u306e<a href=\"https:\/\/github.com\/MicrosoftEdge\/JSBrowser\" title=\"MicrosoftEdge_JSBrowser\" target=\"_blank\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304cGitHub\u3067\u516c\u958b<\/a>\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001WebView\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u958b\u767a\u306b\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u662f\u975e\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Microsoft Edge Dev Blog\u306b\u300cCreating your own browser with HTML and JavaScript\u300d\u3068\u3044\u3046\u8a18\u4e8b\u304c\u30a2\u30c3\u30d7\u3055\u308c\u307e\u3057\u305f\u3002 \u3053\u308c\u3092\u898b\u308b\u3068\u3001\u4f55\u3084\u3089WebView\u30b3 [&hellip;]","protected":false},"author":1,"featured_media":7115,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u7c21\u5358\u306b\u5168\u753b\u9762\u8868\u793a\u3067\u304d\u308b\u306e\u306b #Edge \u3060\u3068\u4f55\u6545\u3067\u304d\u306a\u3044\u306e\u304b\u304c\u7591\u554f\u3002 [[Windows 10]UWP\u30a2\u30d7\u30ea\u3067WebView\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u307f\u305f\u3002]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[132,25,133],"tags":[],"class_list":["post-6167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows10","category-windows","category-microsoft-edge"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-MicrosoftEdge.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1Bt","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6167"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6167\/revisions"}],"predecessor-version":[{"id":6169,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6167\/revisions\/6169"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7115"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}