
getVersion() Global Function
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
539
Finally, getURL() can also be used to execute JavaScript code. Here we invoke a simple
JavaScript alert using getURL():
getURL ("javascript: alert('hello world');");
Note that execution of JavaScript code from a URL does not work in Internet Explorer 4.5
for Macintosh.
Example
Here’s the code for a standard button that links to a web page:
link_btn.onRelease = function () {
getURL("http://www.macromedia.com/");
}
Bugs
Internet Explorer 4.5 (IE 4.5) and older versions on Macintosh do not support the "POST"
method of a getURL( ) call. To service those browsers, use "GET" instead of "POST" (subject
to the length limitations cited earlier).
In most browsers, relative URLs passed to getURL( ) are resolved relative to the HTML file
that contains the .swf file. In IE 4.5 and older versions on Macintosh, relative links are
resolved relative to the location of the .swf file, not the HTML file, which causes problems
when the two are in different directories. To avoid the problem, either place the .swf and
.html files in the same directory or use absolute URLs when invoking getURL( ), such as:
getURL ("http://www.someserver.com/")
See Also
loadMovie(), loadVariables( ), the LoadVars class, MovieClip.getURL( ), MovieClip.
loadVariables(