Webview supports JavaScript, but it is only limited to local JS Code. It does not provide recursive download functions as powerful as PC browsers (possibly because of limited storage of mobile phones ).
Therefore, to develop a JS-based anroid program, you can only execute local JS and CSS code.
I tried to use the following code in anroid,Failed:
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> modify MAP status </title>
<SCRIPT type = "text/JavaScript" src = "http://api.map.baidu.com/api? V= 1.1 & Services = true "> </SCRIPT>
</Head>
<Body>
<Div style = "width: 520px; Height: 340px; Border: 1px solid gray" id = "Container"> </div>
</Body>
</Html>
<SCRIPT type = "text/JavaScript">
VaR map = new bmap. Map ("Container"); // create a map instance
VaR point = new bmap. Point (116.403765, 39.914850); // create Coordinate
Map. centerandzoom (point, 15); // you can specify the coordinates of the center and map level. More importantly, map Initialization
SetTimeout (function (){
Map. Panto (New bmap. Point (116.409, 39.918 ));
},2000 );
</SCRIPT>
Therefore, to make it better to execute Js in anroid, you can only put resources in HTML text by hard coding: for example:
Background-image: URL (data: image/GIF; base64, AAAA)
Format:
Where:
Data: ---- get the data type name image/GIF; ----- index data type name base64 ----- indicates the encoding mode AAAAA ------ indicates the encoded result.
Background-image: URL (data: image/GIF; base64, AAAA) indicates that "the retrieved data type is an image GIF file, which is encoded with ASCII characters, the ASCII code is 'aaa '"
The image itself already exists in the document in the form of ASCII. You only need to compile it in the browser.
Likewise: