-
27 February 2015, 8:31 pm
#1
HTML5 Qestion - Modernizr
I just started reading a book HTML up and running by Mark Pilgrim. There is a script about modernizr, that you put in your header to detect what type of browser the person is using. Does anyone use this? Can anyone help me understand this in lamens terms? This is the script. Thank you
<!DOCTYPE html>
<html>
<head>
<meta charset=“utf-8”>
<title>Dive Into HTML5</title>
<script src=“modernizr.min.js”></script>
</head>
<body>
Text in body
</body>
</html>
<meta charset="“utf-8”">
<title>Dive Into HTML5</title>
<script src="“modernizr.min.js”"></script>
-
-
27 February 2015, 9:18 pm
#2
I always try and get newly published/edition books. I googled that book and its from 2010? Is that correct or do you have an updated edition?
let me add the reason I say the date of the book matters is technology is always changing, back in 2010 what browsers were out there? IE8? IE9 was 2011 I think. Well almost nobody uses IE8 these days and I see many major sites dropping support for them.
Its not browser detection but more feature detection. In other words does the browser version support the features of CSS3 and HTML5.
Amazing how many sites think feature detection is something new, I was using it back when IE 4 came out.
So here is a site that lists html5 features and browser versions that support them, make sure you check your browser and then other browsers. https://html5test.com/index.html
here si another site that explains using mordernizr in detail.
http://html5doctor.com/using-moderni...ide-fallbacks/
Last edited by slotplayer; 27 February 2015 at 9:31 pm.
-
-
27 February 2015, 9:52 pm
#3
Thank you! Yes that book was written in 2010 but I thought HTML5 was HTML5, I didn't think about the change in browsers.
The reason I want to learn to code is to be able to write my owns scripts for thinks like geo targeting and other things for my site without using a wordpress plugin, which may slow the site down.
Let's say I write a script for geo targeting, The moderizer is a tool to help me test every browser to see if the if the script is working (if I am using a VPS)? If Firefox releases a new update all webmasters have to check to see if their code is up to date with the latest edition and tweak it if it is not?
-
-
27 February 2015, 11:49 pm
#4
no, what modernizr does is two things: First it allow you to first check if a particular HTML5 and CSS Level 3 feature is supported by whatever browser/version the visitor is using and tells you in advance so your code can decide what to do if its supported or if not supported.
The second thing it does is have what they call pollyfills which replicate the html5 feature in non-supporting browsers like IE8.
So if you can see the Modernizr tutorial code segment below.
test: Modernizr.geolocation simple asks does the visitors browser/version support the html5 feature geolocation?
If yep run the geo.js script if nope run the geo-polyfill.js script.
Modernizr.load({
test: Modernizr.geolocation,
yep : 'geo.js',
nope: 'geo-polyfill.js'
});
So I know IE9 supports html5 Geolocation while IE8 doesn't. In either case Modernizr covers me.
-
The Following User Says Thank You to slotplayer For This Useful Post:
edgarf76 (28 February 2015)
-
28 February 2015, 12:00 am
#5
So like a bb.....boo....a book....with words on paper pages and stuff???
So you see all you youngins....they DO exist.....lol
Ooops sorry, actually this could be a very interesting discussion since I have not yet had the time to look at all the changes in html 5.
Scanning the page quick on the modernizer, it does appear to be a way to start developing for 5 and stay a backwards compatable....like ummmm....that other company has always tried to do that people claim lives in the past.....Microsoft.
Rick
Universal4
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules