Return true if we succeeded.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4462 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -8,15 +8,17 @@ public class NetUtil
|
||||
/**
|
||||
* Convenience method to load a web page in the browser window without
|
||||
* having to worry about SecurityErrors in various conditions.
|
||||
*
|
||||
* @return true if the url was unable to be loaded.
|
||||
*/
|
||||
public static function navigateToURL (
|
||||
url :String, preferSameWindowOrTab :Boolean = true) :void
|
||||
url :String, preferSameWindowOrTab :Boolean = true) :Boolean
|
||||
{
|
||||
var ureq :URLRequest = new URLRequest(url);
|
||||
if (preferSameWindowOrTab) {
|
||||
try {
|
||||
flash.net.navigateToURL(ureq, "_self");
|
||||
return;
|
||||
return true;
|
||||
} catch (err :SecurityError) {
|
||||
// ignore; fall back to using a blank window, below...
|
||||
}
|
||||
@@ -25,12 +27,13 @@ public class NetUtil
|
||||
// open in a blank window
|
||||
try {
|
||||
flash.net.navigateToURL(ureq);
|
||||
return true;
|
||||
} catch (err :SecurityError) {
|
||||
Log.getLog(NetUtil).warning(
|
||||
"Unable to navigate to URL [e=" + err + "].");
|
||||
}
|
||||
|
||||
return false; // failure!
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user