Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Web View Set HTML not working specially for Content type - Only android some devices

$
0
0

Hello,

I have following program.

app.js

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.

Can you please help me out to work with this problem ?

Thank you.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>