The reason is that the webpage in the local document has the following js code that will load information online. Just comment it out.
Copy codeThe Code is as follows: <script src = "http://www.google.com/jsapi" type = "text/javascript"> </script>
You can use the java code to comment in batches.
Copy codeThe Code is as follows: package cn. sd. fxd. android;
/*
* Remove the javascript code that requires Internet connection from the Android document.
*/
Import java. io. BufferedReader;
Import java. io. BufferedWriter;
Import java. io. File;
Import java. io. FileNotFoundException;
Import java. io. FileReader;
Import java. io. FileWriter;
Import java. io. IOException;
Public class FormatDoc {
Public static int j = 1;
/**
* @ Param args
*/
Public static void main (String [] args ){
File file = new File ("D:/android-sdk-windows/docs /");
SearchDirectory (file, 0 );
System. out. println ("OVER ");
}
Public static void searchDirectory (File f, int depth ){
If (! F. isDirectory ()){
String fileName = f. getName ();
If (fileName. matches (".*?. Html ")){
String src = "<script src = \" http://www.google.com/jsapi\ "type = \" text/javascript \ "> </script> ";
String dst = "<! -- <Script src = \ "http://www.google.com/jsapi\" type = \ "text/javascript \"> </script> --> ";
// If it is an html file, comment out the specific javascript code.
Annotation (f, src, dst );
}
} Else {
File [] fs = f. listFiles ();
Depth ++;
For (int I = 0; I <fs. length; ++ I ){
File file = fs [I];
SearchDirectory (file, depth );
}
}
}
/*
* F files in which specific content will be modified
* Src replaced content
* Dst replaces the content of the layer.
*/
Public static void annotation (File f, String src, String dst ){
String content = FormatDoc. read (f );
Content = content. replaceAll (src, dst );
FormatDoc. write (content, f );
System. out. println (j ++ );
Return;
}
Public static String read (File src ){
StringBuffer res = new StringBuffer ();
String line = null;
Try {
BufferedReader reader = new BufferedReader (new FileReader (src ));
Int I = 0;
While (line = reader. readLine ())! = Null ){
If (I! = 0 ){
Res. append ('\ n ');
}
Res. append (line );
I ++;
}
Reader. close ();
} Catch (FileNotFoundException e ){
E. printStackTrace ();
} Catch (IOException e ){
E. printStackTrace ();
}
Return res. toString ();
}
Public static boolean write (String cont, File dist ){
Try {
BufferedWriter writer = new BufferedWriter (new FileWriter (dist ));
Writer. write (cont );
Writer. flush ();
Writer. close ();
Return true;
} Catch (IOException e ){
E. printStackTrace ();
Return false;
}
}
}
There is a way to delete the js Code through shell on the Internet, which is very simple and convenient, 100 times more convenient than the java I wrote, I HATE JAVA
Copy codeThe Code is as follows: find.-name "*. html" | xargs grep-l "jsapi" | xargs sed-I '/jsapi/d'
Another method is to disconnect the network, or use IE or firefox to browse offline.