Its possible to share a JavaScript file between a parent and a child frame? My idea is to prevent reloading of the same JavaScript files on each frame. For example, if i have jquery.js file on the parent, on the child frame that script can be inherited from the parent.
frame souce:
<frameset rows="78px,*" framespacing="0" frameborder="0" border="0">
<frame src="indexFrame.html" name="status" id="status"/><!-- noresize="noresize" scrolling="no"-->
<frame src="DeviceTreeMenu.html" name="desktop" id="TreeMenu"/>
<noframes>
<body>
<p>This page requires frame support and apparently this Web browser doesn't support this feature. Please check the Browser configuration, switch to another browser or try the <a href="menu.html">menu page</a> as a resort.</p>
</body>
</noframes>
</frameset>
Thank you
You have to include it in both. Frames are similar to different windows or tabs. (Usually the browser will cache it, so you will not have a performance issue).
You can access the window property of a parentframe by calling parent. In that way you can import properties from the parent.
parent.document.body.appendChild(parent.document.createTextNode("Foobar"));
var $ = parent.$ // e.g. jquery instance of parentframe
Note that depending on the browser implementation, that the context of the function calls may or may not be changed to the parentwindow. I couldn't recheck that yet.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.