[TIMOB-23479] Windows: Local webview does not show any images, or opens other files.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-06-30T07:24:45.000+0000 |
Affected Version/s | Release 5.3.0 |
Fix Version/s | Release 6.0.0 |
Components | Windows |
Labels | n/a |
Reporter | Sharif AbuDarda |
Assignee | Kota Iguchi |
Created | 2016-06-07T07:37:43.000+0000 |
Updated | 2016-10-14T17:01:14.000+0000 |
Description
Hello, I have a local webpage which I want to open in webview. This works fine, But, I have an image, inside my webpage, which does not show when the webview opens.
I am putting my html and image file in assets directory, which is not working. I even tried to put the files in lib directory, which also does not work.
I also tried with hyperlink inside my webpage, which will open another local webpage. I can see the hyperlink in webview but clicking on it does not open my webpage.
I am testing for both alloy and classic project. I am using SDK 5.2.2.GA and 5.3.0.GA.
var webview = Titanium.UI.createWebView({url:'logging.html});
var window = Titanium.UI.createWindow();
window.add(webview);
window.open({modal:true});
<Alloy>
<Window id="win" modal="true">
<WebView id="webview" url="logging.html" />
</Window>
</Alloy>
I have tested in android without any problem. Thanks.
Attachments
File | Date | Size |
---|---|---|
logging.html | 2016-06-07T07:31:25.000+0000 | 165 |
sample.jpg | 2016-06-07T07:31:29.000+0000 | 325935 |
> I am using SDK 5.2.2.GA and 5.3.0.GA. Hi, These issues occur after 5.3.0.GA. :HTML can't display an image. hyperlink does not work. And it not occur in 5.2.2.GA in my environment.
Local links are not working because Windows Phone WebView (browser controls) doesn't allow local link unless you explicitly specify
ms-appx-web://
. I would suggest use of following workaround: For images:For local links:
Thank you for comment. I tried to change the html, it is shown jpeg file correctly. and I confirmed that HTML can call hyperlink. However, I'd like to put logging.html into "ms-appdata:///local/". and I can't access logging.html at "ms-appdata:///local/". How can I access logging.html within "ms-appdata:///local/"?
Looks like Windows WebView accepts local content only from sub directory of the root url where you
WebView.Navigate
(in Titanium it'sWebView.url
property). In addition to that, the file content inms-appdata
should be placed under subdirectory of local folder: {quote} The WebView support for this scheme requires you to place your content in a subfolder under the local or temporary folder. This enables navigation to URIs such as ms-appdata:///local/folder/file.html and ms-appdata:///temp/folder/file.html {quote} (See https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.webview.aspx) So This mean you may need to copy index content to application data directory and navigate toms-appdata:///local/xxx/index.html
in order to load content underms-appdata:///local/xxx/
. Let say you have index content in application resource directory:FYI http://wakiama.hatenadiary.jp/entry/2016/02/20/120728 (Japanese)
Thanks for your advice. I create new folder that named "webroot" in applicationDataDirectory, and copy HTML resourse file (ex.logging.html, sample.jpg) from ResourceDirectory. then, I can display logging.html where in "ms-appdata:///local/webroot/". but, "ms-appdata:///local/webroot/logging.html" can not display the referenced file:"ms-appdata:///local/webroot/sample1.jpg","ms-appdata:///local/webroot/logging2.html". I tried these HTML tags for display to "ms-appdata:///local/webroot/sample1.jpg". but "ms-appdata:///local/webroot/sample1.jpg" was not displayed. identically, I tried hyperlink, but these tags not worked. logging2.html logging2.html logging2.html logging2.html logging2.html logging2.html logging2.html How can I call "ms-appdata:///local/webroot/sample1.jpg" and "ms-appdata:///local/webroot/logging2.html" from "ms-appdata:///local/webroot/logging.html"?
I am able to reproduce the issue too. According to [this blog](http://wakiama.hatenadiary.jp/entry/2016/02/20/120728) relative link for
ms-appdata
should work, but it does not for me. Investigating.https://github.com/appcelerator/titanium_mobile_windows/pull/749
Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-58 Appc NPM: 4.2.8-7 Ti SDK: 6.0.0.v20161013072802 Appc Studio: 4.8.0.201610060953 Lumia 550 10.0 Local webview now shows images stored locally on the device Closing ticket