{"id":10550,"date":"2015-01-20T14:15:50","date_gmt":"2015-01-20T19:15:50","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10550"},"modified":"2020-02-24T15:44:22","modified_gmt":"2020-02-24T20:44:22","slug":"wkwebview-sandboxing-and-searching","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/01\/20\/wkwebview-sandboxing-and-searching\/","title":{"rendered":"WKWebView, Sandboxing, and Searching"},"content":{"rendered":"<p><a href=\"http:\/\/inessential.com\/2015\/01\/20\/frustration\">Brent Simmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/inessential.com\/2015\/01\/20\/frustration\">\n<p>But the new replacement for WebView &mdash; WKWebView &mdash; doesn&rsquo;t have this bug. Which is great. Let&rsquo;s adopt the new thing! I&rsquo;m all in. Love new things.<\/p>\n<p>[&#8230;]<\/p>\n<p>I did some research, and I learned that WKWebView won&rsquo;t show local content &mdash; that is, files that are loaded from the app&rsquo;s bundle. Files from the app bundle ought to be a-okay, ought not be a sandbox violation, but apparently they are.<\/p>\n<p>[&#8230;]<\/p>\n<p>In an ideal world, WKWebView would work with files from the app bundle, and, as a replacement for WebView, it would have the same functionality as WebView (a searchFor or equivalent method). Anything else means running as fast as I can while I slip backwards.<\/p>\n<\/blockquote>\n<p>Update (2015-01-21): <a href=\"https:\/\/code.google.com\/p\/chromium\/issues\/detail?id=423444\">Chromium<\/a> (via <a href=\"https:\/\/twitter.com\/MSch\/status\/557873070774706176\">Martin Schurrer<\/a>):<\/p>\n<blockquote cite=\"https:\/\/code.google.com\/p\/chromium\/issues\/detail?id=423444\"><p>Unfortunately, despite the advantages of WKWebView, it has some significant technical limitations that UIWebView does not, which means we can&rsquo;t simply drop it in as a replacement.<\/p><\/blockquote>\n<p>Update (2015-01-24): <a href=\"http:\/\/stackoverflow.com\/a\/26054170\/6311\">Dan Fabulich<\/a>:<\/p>\n<blockquote cite=\"http:\/\/stackoverflow.com\/a\/26054170\/6311\"><p>There is a workaround, demonstrated by shazron here <a href=\"https:\/\/github.com\/shazron\/WKWebViewFIleUrlTest\">https:\/\/github.com\/shazron\/WKWebViewFIleUrlTest<\/a> to copy files into \/tmp and load them from there.<\/p><\/blockquote>\n<p>Update (2015-04-23): The bug is <a href=\"http:\/\/stackoverflow.com\/questions\/24882834\/wkwebview-not-working-in-ios-8-beta-4\">still present<\/a> in iOS 8.4b1.<\/p>","protected":false},"excerpt":{"rendered":"<p>Brent Simmons: But the new replacement for WebView &mdash; WKWebView &mdash; doesn&rsquo;t have this bug. Which is great. Let&rsquo;s adopt the new thing! I&rsquo;m all in. Love new things. [&#8230;] I did some research, and I learned that WKWebView won&rsquo;t show local content &mdash; that is, files that are loaded from the app&rsquo;s bundle. Files [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-02-24T20:44:25Z","apple_news_api_id":"d3214d46-de4e-4fd3-9b0a-ea69be34ae9a","apple_news_api_modified_at":"2020-02-24T20:44:25Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A0yFNRt5OT9ObCuppvjSumg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[131,31,904,30,903,71,53,328,1926],"class_list":["post-10550","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bug","tag-ios","tag-ios-8","tag-mac","tag-mac-os-x-10-10-yosemite","tag-programming","tag-sandboxing","tag-webkit","tag-wkwebview"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=10550"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10550\/revisions"}],"predecessor-version":[{"id":11051,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10550\/revisions\/11051"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}