If DOCTYPE is not specified on Chrome, Firefox, or Safari, is there a way
to find the viewport's height?
The following code can correctly find the viewport's height, either using
plain JavaScript or jQuery, but what if the DOCTYPE is not specified, then
both lines that reported something like 410 would now report something
like 3016.
Is there a way to find the viewport's height if DOCTYPE is not specified?
<!DOCTYPE html>
<html>
<head>
<style>
body { height: 3000; }
</style>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
onload = function() {
console.log("jQuery version", $.fn.jquery);
console.log("document.compatMode is", document.compatMode);
// using jQuery
console.log("$(window).height() is", $(window).height());
// using plain JavaScript
console.log("document.documentElement.clientHeight is",
document.documentElement.clientHeight);
}
</script>
</head>
<body>
hi
No comments:
Post a Comment