This is because the local documents in the page has the following two-segment JS code will be networked loading information, comments out after it is good
<link rel= "stylesheet" href= "Http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic, Mediumitalic,bold "title=" Roboto ">
<script src= "Http://www.google.com/jsapi" type= "Text/javascript" ></script>
Use the following Java code to bulk annotate
Press CTRL + C to copy the code
/*
* Remove JavaScript code that requires networking in Android documents
*/
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/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 (); The
if (Filename.matches (". *.{ 1}html ") {
String src= < (link rel) [=]\" (stylesheet) \ "\ n (HREF) [=]\] (HTTP)://(FONTS.GOOGLEAPIS.COM/CSS) [?] (family) [=] (Roboto) [:] (Regular,medium,thin,italic,mediumitalic,bold) \ "(title) [=]\" roboto\ ">";
String src1 = "<script src=\" http://www.google.com/jsapi\ "type=\" text/javascript\ "></script>";
String DST = "";
//If it is an HTML file, comment out the specific JavaScript code in it
annotation (f, SRC, DST);
annotation (f, src1, DST);
}
} else {
file[] fs = F.listfiles ();
depth++;
for (int i = 0; i < fs.length; ++i) {
File File = fs[ I];
Searchdirectory (file, depth);
}
}
}
/*
* F files that will be modified for specific content
* SRC will be replaced by the content
* DST will be replaced with the content of the layer
*/
public static void annotation (File f, string src, string dst) {
String content = Formatdoc.read (f);
Content = Content.replacefirst (src, DST);
int Ll=content.lastindexof (SRC);
System.out.println (LL);
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;
}
}
}
Press CTRL + C to copy the code
Online there is a way to remove the line of JS code through the shell, very simple and convenient, 100 times times more convenient than the Java above, but can not delete the first section JS code
Find. -name "*.html" |xargs grep-l "Jsapi" |xargs sed-i '/jsapi/d '
The other way is to break the net, or use Ie,firefox offline browsing