ECMAScript edition 2 suggests this is a future extension. As of the third edition of the ECMAScript standard it is still denoted as a reserved word.
Netscape 4 anticipates that a future standard will endorse this capability and provides it anyway.
This functionality allows layers to define handlers for themselves and then export them to allow other layers or windows to call them.
This facility is also useful to allow controlled access via the security policy. This can then allow an unsigned script to have access to content in a signed script's context.
This is good Object Oriented Programming technique on the grounds that hiding the private data and making a public interface available means code can be reused. This black-box approach is much used in languages such as Java, SmallTalk and Objective-C.
This only works in Netscape version 4 when the LANGUAGE attribute is set to "JavaScript1.2". This will affect the behavior of the == and != operators as well.
This can affect the security policy regarding the "same-signer" trustworthiness of a page.
Be careful that you do not export a secure method or property and allow it to be executed or seen by insecure and untrusted non-signed scripts running in other windows.
<HTML> <HEAD></HEAD> <BODY> <SCRIPT> var myLocalVariable; function myLocalFunction() { document.write("Test"); } export myLocalVariable; export myLocalFunction; </SCRIPT> </BODY> </HTML>
See also: | import, Same origin, Signed scripts |
Prev | Home | Next |
Exponent-log function | Up | Expression |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |