Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1634] Web View Set HTML not working specially for Content type - Only android some devices

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2014-03-10T05:37:36.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labels4.1.2, Galaxy, Note1, Samsung, android, webview
ReporterAvtarSingh Suchariya
AssigneeRitu Agrawal
Created2014-03-06T08:41:03.000+0000
Updated2016-03-08T07:38:07.000+0000

Description

Hello, I have following program.

var winMain = Titanium.UI.createWindow({
	backgroundColor : 'black'
});

var content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
'<html xmlns="http://www.w3.org/1999/xhtml">' +
    '<head>' +
		'<meta http-equiv="Content-Type" content="text/html; charset=utf-8 " />' +
        '<meta http-equiv="Content-Type" content="text/html; charset=U+04FF Cyrillic" />' +
        '<meta name="viewport" content="width=device-width, initial-scale=1.0">' +
    '</head>' +
    '<body>' +
        '<p>Declaração 1 é maior</p>' +
        '<p>Statement 1 er større</p>' +
        '<p>Stelling 1 is groter</p>' +
        '<p>Lausunto 1 on suurempi</p>' +
        '<p>Déclaration 1 est supérieure</p>' +
        '<p>Erklärung 1 größer ist</p>' +
        '<p>Δήλωση 1 είναι μεγαλύτερη</p>' +
        '<p>Pernyataan 1 lebih besar</p>' +
        '<p>Dichiarazione 1 è maggiore</p>' +
        '<p>ステートメント1は大きい</p>' +
        '<p>문 1 큰</p>' +
        '<p>Pernyataan 1 adalah lebih besar</p>' +
        '<p>Declaración 1 es mayor</p>' +
        '<p>Uttalelse 1 er større</p>' +
        '<p>Declaração 1 é maior</p>' +
        '<p>Утверждение 1 больше</p>' +
        '<p>表1是更大</p>' +
        '<p>Uttalande 1 är store</p>' +
        '<p>1 คำสั่งที่มีขนาดใหญ่</p>' +
        '<p>表1是更大</p>' +
        '<p>Açıklama 1 daha büyüktür</p>' +
        '<p>Tuyên bố 1 lớn</p>' +
    '</body>' +
'</html>';

var webView = Titanium.UI.createWebView({
	height : '95%',
	width : '95%'
});

winMain.add(webView);

winMain.open();

webView.setHtml(content);
// webView.setUrl('http://www.suchariya.com/test.html');

alert(webView.getHtml());

This is multiple language program content. The problem is when I uses code "webView.setUrl('http://www.suchariya.com/test.html');" it works fine as it should. But when I copy the same HTML content from Web and setting as "webView.setHtml(content);" it does not work as it should. The problem which I see is, Setting "webView.setHtml(content);" discard the content type and doctype but the same remain there while using "webView.setUrl('http://www.suchariya.com/test.html');" Another surprising thing is when I uses "webView.setHtml(content);", it showing me wearied but when I print the same in alert " alert(webView.getHtml());" it is showing the correct content. This problem I am facing on Samsung Galaxy Note 1 - Android 4.1.2 but the same is working fine on Nexus 5. I am also attaching .js file here. Because there is nothing else is required to run/test this project. I also attached wrong output (using Setting content in Web View) and correct output (using URL in Web View) as a device screenshot. Can you please help me out to work with this problem ? Thank you.

Attachments

FileDateSize
app.js2014-03-06T08:41:03.000+00001828
Correct Output - URL.png2014-03-06T13:02:44.000+0000126850
Wrong Output - Content.png2014-03-06T13:02:44.000+0000147558

Comments

  1. Ritu Agrawal 2014-03-07

    AvtarSingh - I tried your code on Samsung Galaxy Note II 4.1.2 and was not able to reproduce. It is showing the correct results. My Titanium SDK version is 3.2.1 GA. Just curious why you are using Titanium SDK 3.0.2 with Studio 3.2.1 GA. Can you please upgrade all components (Studio, SDK and CLI) to the 3.2.1 GA version and see if it makes a difference?
  2. AvtarSingh Suchariya 2014-03-08

    Hello Ritu, I just tested with 3.2.1 GA and it's also working fine on my device. Now, I am using the version of 3.0.2 is because this product already build on that and working fine. but when we switch from previous SDK version to 3.2.1 GA or any newer than 3.0.2, It's getting problem mainly with facebook integration. So we are not updating the app. Not tested if there are other problem also.
  3. Ritu Agrawal 2014-03-10

    It is good to know that your program works fine with 3.2.1 release. This release includes many new enhancements and fixes including iOS7 support so I would strongly recommend you to upgrade. Please file another ticket for Facebook integration and we would be happy to look at that issue.

JSON Source