Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
147 views
in Technique[技术] by (71.8m points)

javascript - 如何使用JavaScript下载完整的HTML页面(How do I download a complete html page using javascript)

So I want to build a script that takes a precise snapshot of the current html page.

(因此,我想构建一个脚本,以获取当前html页面的精确快照。)

I'm aware that one can easily obtain the current html page using eg new XMLSerializer().serializeToString(document) .

(我知道可以使用例如new XMLSerializer().serializeToString(document)轻松获得当前的html页面。)

However, if a that html page contains relative path references to scripts, css stylesheets, or expiring image urls - rendering the webpage at a later date would be broken.

(但是,如果该html页面包含对脚本,css样式表或过期的图像url的相对路径引用,则在以后渲染该网页将被破坏。)

An ideal solution would generate a single standalone html page where script images, css, etc are replaced in-place to include their content.

(理想的解决方案是生成一个独立的html页面,在其中将脚本图像,css等替换为原位以包含其内容。)

Pure javascript is perforable if possible.

(如果可能,可以使用纯JavaScript。)

  ask by Uri Merhav translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...