Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13045] iOS: WebView does not load local html files without ".html" file extension

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2013-03-21T18:28:37.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsregression
ReporterTommy Leung
AssigneeShak Hossain
Created2013-03-11T17:24:08.000+0000
Updated2017-03-22T18:08:05.000+0000

Description

Problem

Loading local files into webview do not work anymore. The latest TI SDk that work with this feature is 3.0.0.GA.

Test case

var win = Ti.UI.createWindow();

var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "testpage");
file.write("<html><body>this is the html page!!!</body></html>")

var webview = Ti.UI.createWebView({
	url: file.nativePath
});

Ti.API.info(file.nativePath)

win.add(webview);

win.open();

Comments

  1. Davide Cassenti 2013-03-13

    The problem does not seem to be visible if the filename has the .html extension; it works fine without extension using 3.0.0.GA
  2. Olga Romero 2013-03-13

    Tested with: Titanium Studio, build: 3.0.3.201302201202 Titanium SDK, build: 3.1.0.v20130312161655 Device: iPhone5 iOS 6.0 Used *the .html extension* in the code, works fine. var win = Ti.UI.createWindow();
     
       var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "testpage.html");
       file.write("<html><body>this is the html page!!!</body></html>")
        
       var webview = Ti.UI.createWebView({
           url: file.nativePath
       });
        
       Ti.API.info(file.nativePath)
        
       win.add(webview);
        
       win.open();
       
  3. Ingo Muschenetz 2013-03-19

    Downgrading as there is a workaround.
  4. Max Stepanov 2013-03-21

    Mime-type is crucial for WebView loading. For remote URLs, mime-type is sent from server. For html/data properties, mime-type is specified in additional properties. For local URLs, file extension should match a valid mime type. This ticket could be resolved as: 1. Won't Fix, requiring valid file extension. 2. Feature Request, so support mimeType property in addition to url.
  5. Ingo Muschenetz 2013-03-21

    This is as a result of https://github.com/appcelerator/titanium_mobile/pull/3701. We've determined that it is important for the user to specify a file ending in .html, or use the mimeType property from the setHtml method which supports content injection.
  6. Lee Morris 2017-03-22

    Closing ticket as the issue will not fix and with reference to the above comments.

JSON Source