:: Forum >>

Safari "Can't find variable: AW"

I am trying to make 2.5 work in Safari, but it is giving me the error "Can't find variable: AW". The same page works fine in IE and in FireFox.

Does anyone know what would cause this?
Aaron Todd
Monday, December 10, 2007
I guess safari cannot load aw.js script for some reason. Do you have the standard examples working? Can you see the grid on this page -
http://www.activewidgets.com/grid/ ? Which version of safari/os?
Alex (ActiveWidgets)
Monday, December 10, 2007
The examples are working fine for me in Safari. I'm using v3.0.4. It just seems to be the page I built, which I created after looking at the example page code.

Here is my code if it helps:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<head>
<meta http-equiv="Content-Language" content="en-us">
<script language="JavaScript" type="text/javascript" src="runtime3/lib/aw.js"></script>
<script language="JavaScript" type="text/javascript" src="script/site.js"></script>
<script language="JavaScript" type="text/javascript" src="script/md5.js"></script>
<link href="styles/main.css" rel="stylesheet" type="text/css"></link>
<link href="runtime3/styles/lgx/aw.css" rel="stylesheet" type="text/css"></link>
<style>
div.div-loginbox{
    margin-top:200px;
    background:url(images/box_middle.png) repeat-y;
}

div.header{
    vertical-align:middle;
    background:url(images/webnexus-logo1.png) no-repeat 20px center;
    height:51px;
    padding-right:20px;
}

div.header img{
    float:right;
}

div.txtEntry{
    text-align:center;
    font-size:16px;
    font-weight:bold;
    padding:5px;
}

div.buttons{
    text-align:center;
    padding:5px;
}

#btnLogin{
    width:75px;
    font-size:14px;
    font-weight:bold;
    color:#000000;
}

div.div-loginbox div.roundtop {
    background: url(images/box_top.png) no-repeat top right;
    margin:0px;
    padding:0px;
    text-align:left;
    height:12px
}
div.div-loginbox div.roundbottom {
    background: url(images/box_bottom.png) no-repeat bottom right;
    margin:0px;
    padding:0px;
    text-align:left;
    height:16px;
}

div.div-loginbox div.prdData{
    font-size:10px;
    padding:0 20px;
    height:10px;
}

div.div-loginbox div.prdData span.version{
    float:left;
}

div.div-loginbox div.prdData span.copyright{
    float:right;
}

</style>
<script language="JavaScript">
function checkKey(){
if (window.event.keyCode == 13){
     button.onControlClicked();
    }
}
window.onload = function (){
    document.getElementById('txtUserName').focus();
}
</script>
</head>
<body>
<div class="div-root">
<div class="div-content">
     <div class="div-loginbox">
     <div class="roundtop"></div>
     <div class="header"><img src="images/logo.jpg"></div>
        <div class="txtEntry">Username:&nbsp; <input type="text" name="txtUserName" id="txtUserName" tabindex="1" maxlength="8" onkeyup="checkKey()"></div>
        <div class="txtEntry">Password:&nbsp; <input type="password" name="txtPassword" id="txtPassword" tabindex="2" maxlength="8" onkeyup="checkKey()"></div>
        <div class="buttons"><span id="btnLogin"></span></div>
        <div class="prdData">
         <span class="copyright"><?php echo COPYRIGHT; ?></span>
         <span class="version"><?php echo PRG_TYPE." Version ".SYS_VER; ?></span>
        </div>
        <div class="roundbottom"></div>
     </div>
    </div>
</div>
<script>
    var button = new AW.UI.Button;
    button.setId("btnLogin");
    button.setControlText("Login");
    button.onKeyEnter = function(event){
this.onControlClicked();
    }
    button.onKeySpace = function(event){
this.onControlClicked();
    }
    button.onControlClicked = function (event){
        var regexValidChars = new RegExp(/[a-zA-Z0-9@]{0,8}/);
        if (document.getElementById('txtUserName').value == ""){
            alert("User name is required");
            document.getElementById('txtUserName').select();
            return false;
        } else {
            if (document.getElementById('txtPassword').value == ""){
                alert("Password is required");
                document.getElementById('txtPassword').select();
                return false;
            } else {
                if (document.getElementById('txtUserName').value != document.getElementById('txtUserName').value.match(regexValidChars)){
                    alert("Invalid user name: Only uppercase and lowercase letters, numbers, and the @ symbol are allowed.");
                    document.getElementById('txtUserName').select();
                    return false;
                } else {
                    if (document.getElementById('txtPassword').value != document.getElementById('txtPassword').value.match(regexValidChars)){
                        alert("Invalid password: Only uppercase and lowercase letters, numbers, and the @ symbol are allowed.");
                        document.getElementById('txtPassword').select();
                        return false;
                    } else {
                        
                    }
                }
            }
        }
    }
    button.refresh();
</script>
</body>
</html>
Aaron Todd
Monday, December 10, 2007
I cannot reproduce this - this page works fine for me. Could it be some issue with caching or server config or maybe path to aw.js?
Alex (ActiveWidgets)
Monday, December 10, 2007
Any idea what kind of server config problems might be the cause?

I've cleared the cache and tripple checked the path to aw.js and still see the same results. Works fin in IE and Firefox, but not in Safari.
Aaron Todd
Monday, December 10, 2007
Alex,

I just looked at my servers config file and found that all .js files were being run through the PHP engine when requested by the client browser. I dont quite understand why it worked in IE and Firefox and not Safari, but keep that in mind if someone else comes up with the same issue.
Aaron Todd
Monday, December 10, 2007

This topic is archived.


Back to support forum

Forum search