Android webview support for JS and href

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.