Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5118] WebView does not set html property on Android

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2017-08-01T08:38:55.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, webview
ReporterRio Diep
AssigneeShak Hossain
Created2017-07-31T02:04:17.000+0000
Updated2017-08-03T05:00:47.000+0000

Description

On android platform the Webview ui component does not set the HTML property when loading local html. The ui populated the html file correctly but its html attribute is always null Sample: (tested with SDK 6.1.1.GA, 6.1.2.v20170727160839) index.xml: index.js: $.index.open(); $.webview.addEventListener('load', function(e) { setTimeout(function() { console.log($webview.html); console.log($webview.getHtml()); },100); }); The log results: null null

Comments

  1. Motiur Rahman 2017-07-31

    Hello [~rdiep], I could not reproduce this issue with the following test code. Please try it then let us know. Titanium SDK SDK Version = 6.1.1.GA Android version: 6,7
       <Alloy>
       	<Window id="win" modal="true">
       		<WebView id="webview" url="/test.html" />
       	</Window>
       </Alloy>
       
       $.win.open();
       $.webview.addEventListener('load', function(e) {
       
       	setTimeout(function() {
       		$.webview.setHtml("<html><head></head><body>hello</body></html>");
       		Ti.API.info($.webview.getHtml());
       	}, 100);
       
       });
       
       
    Thanks
  2. Rio Diep 2017-08-01

    Hi @Motiur Rahman Sorry for not explaining clearly from the start. What i meant was if you didn't have this line
       $.webview.setHtml("<html><head></head><body>hello</body></html>");
       
    the html attribute of webview always returns null even the UI has loaded the content of local html file successfully.

JSON Source