如何防止Applet跨网页卸载?
我有一个大型小程序,需要大约 40 秒才能初始化(出租车已缓存,因此请忽略此问题的下载时间)。
问题是,如果用户转到启动小程序(单个窗口)的页面 A,然后导航到页面 B,则小程序将被卸载。 如果用户返回页面 A,他们将再次经历 40 秒的初始化时间。
我希望能够启动该小程序,一次且仅一次产生 40 秒的初始化时间。 小程序需要驻留在单个浏览器窗口(与我的 Web 应用程序相同的窗口)内。 换句话说,我无法在弹出窗口中启动小程序。
有人对如何防止小程序卸载有什么创意吗?
I have a large applet that takes some 40 seconds to initialize (cabs are cached so ignore download time for this question).
The issue is, if the user goes to Page A which launches the applet (single window) and then navigates to page B, the applet is unloaded. If the user goes back to Page A, they incur the 40 seconds init time once again.
I'd like to be able to launch the applet, incurring the 40 seconds init time once and only once. The applet needs to reside inside a single browser window (the same window as my web application). In other words, I cannot launch the applet in a popup.
Does anyone have any creative ideas around how to prevent the applet unloading?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
唯一的选择是将您的内容放入包含整个文档的 iframe 中,并为小程序使用绝对定位。
使用像这样的 css:
有很多缺点:
The only option would be to put you content in an iframe that encompasses your whole document and use absolute positionning for the applet.
With a css like this one:
There are MANY drawbacks:
您可以这样显示警告:
这适用于几乎所有浏览器,但您无法更改文本周围的文本。
You could show a warning, this way:
This works in allmost every browser, but you cannot change the text surrounding your text.
将 Applet 放入不会卸载的框架中,或阻止用户转到包含 Applet 的网页中的另一个页面。
Put the Applet in a frame that doesn't unload, or prevent the user from going to another page in the web page that contains the Applet.
我想也许有一种方法可以弹出一个小浏览器窗口并在其中加载小程序,然后使用 Javascript 以某种方式将小程序从较小的窗口拉入较大的浏览器。
但我不认为我可以用这种方式操纵 DOM。
还有其他想法吗?
I thought maybe there'd be a way to popup a tiny browser window and have the applet load in that, then using Javascript somehow pull in the applet from the smaller window into the larger browser.
I don't think I can manipulate the DOM in this way though.
Any other ideas?