如何离线保存网页保存将网页保存成离线网页

如何将一个完整地网站保存到本地,可以离线查看?
如何将一个完整地网站保存到本地,可以离线查看?
我见过有chm格式的文件保存的网站的完整内容,请问如何具体的制作步骤是什么,用什么软件?或者有什么更简单可行的办法嘛?谢谢。
CuteFTP,如果你有那个网站的FTP账号。你会懂的。
请遵守网上公德,勿发布广告信息
相关问答:
您好,可以用IE打开,选择脱机查看即可,然后下次可以不用联网即可登陆
这个简单啊!
打开IE--文件--另存为--如图:如何在计算机上完整的保存网页内容
靠谱的软件下载站
当前位置: &///
如何在计算机上完整的保存网页内容
阅读(7585)
在IE浏览器中,我们可以通过浏览器中的&文件&下拉菜单中的&另存为&来将当前的页面保存。保存的时候我们在&文件名&框中键入网页的文件名以后,在&保存类型&中我们可以选择&网页,html&,这样可以完整的保存网页。
另一种保存的类型就是&网页,全部&,这个选项就更强大了,可以将当前页面中的图像、框架和样式表均保存,并将当前页面显示图像文件一同下载并保存到一个&xxx.file&文件下。Internet Explorer将自动修改网页中的连接,实现离线浏览。用户名:小新专栏
文章数:88
评论数:48
访问量:1080387
注册日期:
阅读量:1297
阅读量:3317
阅读量:583158
阅读量:468221
51CTO推荐博文
当我们使用浏览器浏览网页时,常常想保存内容,目的可能是离线阅读或者是收藏。之前的一个项目用到一些,一并总结。方式一,Snapshot4.0支持此方法saveViewState(),方法源码如下/**
* Saves the view data to the output stream. The output is highly
* version specific, and may not be able to be loaded by newer versions
* of WebView.
* @param stream The {@link OutputStream} to save to
* @return True if saved successfully
public boolean saveViewState(OutputStream stream) {
return ViewStateSerializer.serializeViewState(stream, this);
} catch (IOException e) {
Log.w(LOGTAG, "Failed to saveViewState", e);
}4.0原生浏览器其实是把网页的内容存入到BLOB中,缺陷很明显,网页一大就保存不了,查了下源码,BLOB保存的数据有大小限制。4.0上,超过2M大小的网页就没法保存,源码截图如下:但是4.1上,saveViewState() 更新了参数,增加了回调。方法源码如下:/**
* Saves the view data to the output stream. The output is highly
* version specific, and may not be able to be loaded by newer versions
* of WebView.
* @param stream The {@link OutputStream} to save to
* @param callback The {@link ValueCallback} to call with the result
public void saveViewState(OutputStream stream, ValueCallback&Boolean& callback) {
if (mWebViewCore == null) {
callback.onReceiveValue(false);
mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SAVE_VIEW_STATE,
new WebViewCore.SaveViewStateRequest(stream, callback));
}4.1原生浏览器去snapshot的处理更好了,明白了这个限制之后,网页的data不存数据库了,改存文件了,所以网页太大不能保存的问题就解决了。考虑到大部分的网页都比较小的情况下,且实现上快速,采用4.0的方法。主代码采用反射调用4.0 的saveViewState()方法,方法名改为mySaveViewState(),代码如下:public boolean mySaveViewState(OutputStream stream) {
boolean ret =
if (mMethodSaveViewState == null)
mMethodSaveViewState = WebView.class.getDeclaredMethod(
"saveViewState", OutputStream.class);
mMethodSaveViewState.setAccessible(true);
} catch (NoSuchMethodException e) {
if (mMethodSaveViewState != null) {
ret = (Boolean) mMethodSaveViewState.invoke(this, stream);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}方式二,Stream(file)因为2.3上不支持saveViewState()方法,所以采用SavePicture(),SavePicture()方法其实来自SaveState(),在webview前进后退后者其他操作时,会保存相应的状态。方法源码如下:/**
* Save the state of this WebView used in
* {@link android.app.Activity#onSaveInstanceState}. Please note that this
* method no longer stores the display data for this WebView. The previous
* behavior could potentially leak files if {@link #restoreState} was never
* called. See {@link #savePicture} and {@link #restorePicture} for saving
* and restoring the display data.
* @param outState The Bundle to store the WebView state.
* @return The same copy of the back/forward list used to save the state. If
saveState fails, the returned list will be null.
* @see #savePicture
* @see #restorePicture
public WebBackForwardList saveState(Bundle outState) {
if (outState == null) {
// We grab a copy of the back/forward list because a client of WebView
// may have invalidated the history list by calling clearHistory.
WebBackForwardList list = copyBackForwardList();
final int currentIndex = list.getCurrentIndex();
final int size = list.getSize();
// We should fail saving the state if the list is empty or the index is
// not in a valid range.
if (currentIndex & 0 || currentIndex &= size || size == 0) {
outState.putInt("index", currentIndex);
// FIXME: This should just be a byte[][] instead of ArrayList but
// Parcel.java does not have the code to handle multi-dimensional
// arrays.
ArrayList&byte[]& history = new ArrayList&byte[]&(size);
for (int i = 0; i & i++) {
WebHistoryItem item = list.getItemAtIndex(i);
if (null == item) {
// FIXME: this shouldn't happen
// need to determine how item got set to null
Log.w(LOGTAG, "saveState: Unexpected null history item.");
byte[] data = item.getFlattenedData();
if (data == null) {
// It would be very odd to not have any data for a given history
// item. And we will fail to rebuild the history list without
// flattened data.
history.add(data);
outState.putSerializable("history", history);
if (mCertificate != null) {
outState.putBundle("certificate",
SslCertificate.saveState(mCertificate));
* Save the current display data to the Bundle given. Used in conjunction
* with {@link #saveState}.
* @param b A Bundle to store the display data.
* @param dest The file to store the serialized picture data. Will be
overwritten with this WebView's picture data.
* @return True if the picture was successfully saved.
public boolean savePicture(Bundle b, final File dest) {
if (dest == null || b == null) {
final Picture p = capturePicture();
// Use a temporary file while writing to ensure the destination file
// contains valid data.
final File temp = new File(dest.getPath() + ".writing");
new Thread(new Runnable() {
public void run() {
FileOutputStream out =
out = new FileOutputStream(temp);
p.writeToStream(out);
// Writing the picture succeeded, rename the temporary file
// to the destination.
temp.renameTo(dest);
} catch (Exception e) {
// too late to do anything about it.
} finally {
if (out != null) {
out.close();
} catch (Exception e) {
// Can't do anything about that
temp.delete();
}).start();
// now update the bundle
b.putInt("scrollX", mScrollX);
b.putInt("scrollY", mScrollY);
b.putFloat("scale", mActualScale);
b.putFloat("textwrapScale", mTextWrapScale);
b.putBoolean("overview", mInZoomOverview);
}具体实现上,我们需要传入一个bundle,保存相应的状态。方式三: png保存成图片的缺陷很大,放缩的失真,不能编辑。Webview有capturePicture()方法支持。源码中此方法的实现如下:/**
* Return a new picture that captures the current display of the webview.
* This is a copy of the display, and will be unaffected if the webview
* later loads a different URL.
* @return a picture containing the current contents of the view. Note this
picture is of the entire document, and is not restricted to the
bounds of the view.
public Picture capturePicture() {
if (null == mWebViewCore) // check for out of memory tab
return mWebViewCore.copyContentPicture();
}传入picture,具体实现如下://FIXME draw on canvas can not run in a non-ui thread
boolean saveAsPng(Context ctx, ContentValues values, Picture picture){
String path = UUID.randomUUID().toString();
OutputStream outs =
if (null == picture)
String png = path + ".png";
outs = ctx.openFileOutput(png, Context.MODE_PRIVATE);
PictureDrawable pictureDrawable = new PictureDrawable(
Bitmap bitmap =
bitmap = Bitmap.createBitmap(
pictureDrawable.getIntrinsicWidth(),
pictureDrawable.getIntrinsicHeight(),
Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawPicture(pictureDrawable.getPicture());
pressFormat.PNG, 100, outs);
outs.flush();
outs.close();
bitmap.recycle();
values.put(SavedPageColumns.TYPE, SavedPage.TYPE_PNG);
values.put(SavedPageColumns.PATH, png);
} catch (Exception e) {
Log.w(LOGTAG, "Failed to save page ", e);
if (outs != null) {
outs.close();
} catch (IOException ignore) {
File file = ctx.getFileStreamPath(path);
if (file != null && file.exists() && !file.delete()) {
file.deleteOnExit();
}方法四: 保存html网页 直接将url给下载管理器即可。本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)您的位置:
& 阅读文章
Chrome保存mht网页文件的方法 – 无需任何插件,完美!
  昨天晚上想要搞定一个 Press 自定义文章类型的问题,吃完晚饭后一直呆在办公室里研究,没搞定。都9点多了,没办法,扫兴而归。本来想放弃了,可是我做不到,回到家继续。终于,在我静下心来读完一篇国外的技术文章后,搞定了!虽然那文章是全英文的,不过基本能看懂。按着它的步骤一步步来,可完美解决我遇到的问题。事后我就想把那篇文章那整个页面保存下来收藏,保存网页最好的方法就是另存为.mht文件了。这是一种聚合网页文件,它可以包括整个网页的文字、图片及Flash等,特别好用。
  一般我用 Google
浏览器上网,遇到要保存mht文件时,把网址复制一下,然后粘贴到
里,再调用 IE 的另存为mht功能。但使用IE保存有时候会有问题,有时保存速度奇慢,有时直接卡住动不了,有时候保存下来,用 IE 自己打开,页面居然不那么完整。有时用 IE 保存下来的mht文件用 Chrome 打开反而完美显示。
  于是就想用 Chrome 直接来保存,怎么弄?很多人会想到使用第三方插件,没错,这类插件是有的。但是,没那个必要了,Chrome 自身已经携带了这个功能。我记得以前是没有的,不知道是从哪个版本开始,已经支持了,只不过没有默认开启。下面介绍使用方法。
  在 Chrome 地址栏中键入“chrome://flags”,回车,这是一个 Chrome 的功能配置页面,项目比较多,我们通过 Ctrl+F 来搜索“mhtml”,找到“将网页另存为 MHTML”这一项,然后点击下方的“启用”即可。
  此时打开任一网页,右击“另存为”,将默认保存为.mhtml文件,即mht文件。这里特意做了下测试,用 IE 和 Chrome 分别保存上述的英文网页,Chrome 保存下来为1.06 MB,IE 为659 KB。文件体积大小点倒没佬关系,关键是离线打开时能完美显示。
属于分类:
本文标签:
人气热度:39,722 人围观
生产日期:日 - 19时03分01秒
看看还有没有您感兴趣的:
网友们正在阅读…

我要回帖

更多关于 电脑怎么保存离线网页 的文章

 

随机推荐