保存子窗口改为保存父窗口(Javascript) [英] Saving a child window saves the parent window instead (Javascript)

查看:85
本文介绍了保存子窗口改为保存父窗口(Javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些Javascript代码可以创建一个保存友好版本的网页。

I have a bit of Javascript code that creates a "save friendly" version of a webpage.


child = window .open(,child);

child.document.write(htmlPage);

htmlPage是页面的基本html,其中包含所有javascript引用,一组不同的标题图像引用等。

"htmlPage" is the basic html of the page with all the javascript references taken out, a different set of header images references, etc.

一切都在弹出窗口中完美显示,没有运行javascript。
当我点击文件 - >另存为时,保存的文件是父窗口及其所有javascript,并且没有子窗口的跟踪。有谁知道如何解决这个问题?我只想保存子窗口。

Everything displays perfectly in the popup window, with no javascript running. When I click on "File->Save As", the saved file is the parent window, along with all of its javascript, and with no trace of the child window. Does anyone know how to solve this problem? I want to save only the child window.

谢谢,
-Kraryal

Thanks, -Kraryal

推荐答案

当您保存页面时,它将保存原始URL内容(例如,就像您下载了新的副本一样)

When you save the page it will save the original URL content (e.g. just as if you downloaded a fresh copy)

如果您想要清理版本,你需要在服务器上生成该版本,并打开带有该URL作为第一个参数的弹出窗口。

If you want a "cleansed" version, you'll need to generate that version on the server, and open the popup with that URL as the first param.

这篇关于保存子窗口改为保存父窗口(Javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆