webAlert

API Quick reference
Variable name: webAlert
CMS versions: 0.9.x + Evo
Variable type: void
Object parent:

API:webAlert

Description

void webAlert(string $msg[, $url]);

Displays a javascript alert alert message in the web browser

Usage / Examples

$modx->webAlert("hello world", "http://www.domain.com"]);

Related

  • regClientScript
  • sendAlert

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;
}
}

Suggest an edit to this page.