框架和iframe是否具有隔离的javascript上下文? [英] Do frames and iframes have isolated javascript contexts?

查看:115
本文介绍了框架和iframe是否具有隔离的javascript上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Chrome中做了一些实验,但我不确定所以我需要确认:

I've made some experiments in Chrome but I'm not sure so I need a confirmation :

我认为iframe和框架是分开的JavaScript上下文,使他们无法在这些框架/ iframe之间共享变量?

Am I correct in thinking that iframes and frames have a separate JavaScript context, making them impossible to share variables between those frames/iframes?

为了简化,我们假设客户端将始终是Chrome的相同版本(这是我的情况) )

To simplify, let's assume that the client will always be the same version of Chrome (it's my case)

推荐答案

是。

但是,你可以使用 frames collection或 parent 访问其他帧(假设它们来自同一个域)。

However, you can use the frames collection or the parent to access other frames (assuming they're from the same domain).

这篇关于框架和iframe是否具有隔离的javascript上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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