且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

家庭内部的框架

更新时间:2023-01-02 11:56:29

首先不建议使用Frameset.其次,通过框架获得一页要通过另一页面来进行精简确实会带来安全隐患,而且还会增加大量的复杂性,因为每个框架都有其自己的生命周期和DOM.我能想到的唯一方法是在母版页的首页(不是masterPage)的头部中指定一个对象,并使页面通过此对象属性和轮询事件进行通信.

在w3c中: ^ ]

在帧之间共享数据

作者可以通过OBJECT元素在多个帧之间共享数据.作者应在框架集文档的HEAD元素中包含OBJECT元素,并使用id属性对其进行命名.框架集中框架内容的任何文档都可以引用此标识符.

下面的示例说明脚本如何引用为整个框架集定义的OBJECT元素:

Firstly Frameset''s are not recommended. Secondly getting one page to comminicate via another via frames does pose secuirty conserns and also adds a massive layer of complexity because each frame has its own lifecycle and DOM. The only way I can think of is specifying an object in the head of the master page (not masterPage) and have the pages communicate via this object property and polling events.

From w3c: http://www.w3.org/TR/html4/present/frames.html[^]

Sharing data among frames

Authors may share data among several frames by including this data via an OBJECT element. Authors should include the OBJECT element in the HEAD element of a frameset document and name it with the id attribute. Any document that is the contents of a frame in the frameset may refer to this identifier.

The following example illustrates how a script might refer to an OBJECT element defined for an entire frameset:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

   "http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
<HEAD>
<TITLE>This is a frameset with OBJECT in the HEAD</TITLE>
<!-- This OBJECT is not rendered! -->
<OBJECT id="myobject" data="data.bar"></OBJECT>
</HEAD>
<FRAMESET>
    <FRAME src="bianca.html" name="bianca">
</FRAMESET>
</HTML>

<!-- In bianca.html -->
<HTML>
<HEAD>
<TITLE>Bianca's page</TITLE>
</HEAD>
<BODY>