blob: e339be17cb931ef9bd6669c8b7b749a9eb13e507 [file] [log] [blame]
<!--
Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<pre id="log"></pre>
<script src="WebKitDetect.js"></script>
<script>
function log(s)
{
document.getElementById("log").appendChild(document.createTextNode(s));
}
function main() {
// Test for WebKit-based browser
var isWebKit = WebKitDetect.isWebKit();
log("Your browser " + (isWebKit ? "uses " : "does not use ") + "WebKit.\r\n");
// Test for minimum support
var isAtLeast418Dot1 = WebKitDetect.versionIsAtLeast("418.1");
log("Your WebKit version is " + (isAtLeast418Dot1 ? "" : "not ") + "at least 418.1.\r\n");
// Examine WebKit version
var version = WebKitDetect.version();
if (version) {
log("Your WebKit version number is " + version.join(".") + ".\r\n");
log("Your WebKit version is " + (version.isNightlyBuild ? "" : "not ") + "a nightly build.\r\n");
log("Version information: \r\n");
for (var p in version)
log("\t" + p + ": " + version[p] + "\r\n");
}
// Test for Mobile WebKit browser
var isMobile = WebKitDetect.isMobile();
var device = WebKitDetect.mobileDevice();
log("You are " + (isMobile ? "surfing" : "not surfing") + " Mobile" + (device ? " on " + device : "") + ".\r\n");
if (isMobile) {
// Examine Mobile version
var mobileVersion = WebKitDetect.mobileVersion();
if (mobileVersion) {
log("Your Mobile version number is " + mobileVersion.join("") + "\r\n");
log("Mobile version information: \r\n");
for (var p in mobileVersion)
log("\t" + p + ": " + mobileVersion[p] + "\r\n");
}
// Test for minimum support
var isAtLeast102 = WebKitDetect.mobileVersionIsAtLeast("1C28"); // String found in Settings/General/About/Version
log("Your " + device + " version is " + (isAtLeast102 ? "" : "not ") + "at least 1.0.2.\r\n");
}
}
main();
</script>