External CSS and JS not loading
I am creating a webview in the following manner:
webviewHTML='<html><head><script type="text/javascript" src="../scripts/jquery.1.4.2.min.js"></script></head><body><span class="newsTitle">'+loadedNews[index].title+'</span><br><span class="newsDate">'+date.substr(0,date.length-15)+'<br></span><hr><span class="newsEntry">'+loadedNews[index].content+'</span></body></html>';
var webview=Titanium.UI.createWebView({html:webviewHTML});
However, the css is definitely not loading properly on android (it works on the iPhone), and neither is the jquery as when I call evalJS it also throws an error.
Any help is appreciated.
2 Answers
-
Did you ever find a solution? I'm having the same problem
-
I haven't tried the technique that you're attempting, but I have had success loading local HTML files. For instance…
var view = Ti.UI.createWebView({url:'localfile.htm'});
Your html file, in this case 'localfile.htm', could use standard links, just as you would for a normal web page. For instance…
<script type='text/javascript' language='javascript' src='script.js'></script>
<link type='text/css' rel='stylesheet' media='screen' href='style.css'>
Although the approach is slightly different, it hopefully provides you the same functionality.