webAlert
Last edited by JP DeVries on Aug 10, 2013.
API:webAlert
API Quick reference
Variable name: | webAlert |
Modx versions: | 0.9.x + Evolution |
Variable type: | void |
Object parent: | DocumentParser |
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; } }
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).