API:webAlert
API Quick reference
|
Description
void webAlert(string $msg[, $url]);
Displays a javascript alert alert message in the web browser
Usage / Examples
$modx->webAlert("hello world", "http://www.google.com"]);
Related
[regClientScript]
[sendAlert]
Notes
Function Source
API Source File | manager/includes/document.parser.class.inc.php | 1259
function webAlert($msg, $url= "") {
$msg= addslashes(mysql_escape_string($msg));
if (substr(strtolower($url), 0, 11) == "javascript:") {
$act= "__WebAlert();";
$fnc= "function __WebAlert(){" . substr($url, 11) . "};";
} else {
$act= ($url ? "window.location.href='" . addslashes($url) . "';" : "");
}
$html= "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>";
if ($this->isFrontend($html))
$this->regClientScript($html);
else {
echo $html;
}
}