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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…