How to degrade HTML5 nicely like we can do with CSS, on older mobile browsers , where javascript supportis almost none?
Is there a way to detect HTML 5 support in browser, server- side and deliver the different mark-up ?
I'm making a mobile site and I want to give different user experience to Smartphone users and feature phone users.
But I don't want to do anything in JavaScript and Also don't want to use JavaScript for feature phones because they don't have good support for JavaScript.
I'm using some CSS3 effect for smartphone and those will be degrade nicely on feature phones.
The main problem is with HTML5, If i use any HTML5 tag it will work on all browser which has support for HTML5 and I will write CSS for HTML5 tags, but layout will be disturbed on phones which are not having HTML5 supported browser.
How to degrade HTML5 nicely like we can do with CSS, on older mobile browsers , where javascript support is almost none?
In desktop website we can use Javascript HTML Shiv, Modernizer etc. to use HTML 5 on non-supported browser. BUT in mobile old browser don't have 开发者_运维问答good support for JavaScript and even JavaScript will decrease the performance of the site and loading will be slow because Smartphones has 3G connection which is fast but older mobile doesn't have.
I can deliver different HTML file for HTML 5 supported browser, but how to do that?
You can detect the Browser and based upon that you can find out whether it supports HTML 5 For Example you can detect the brower whether its IE9 and if its IE9 it suppors html5
or you can do this http://geekswithblogs.net/ranganh/archive/2011/03/26/html5-development-with-visual-studio-2010-service-pack-1.aspx Below is the excerpt from the blog
Its safe to test for features in a browser rather than simple browser detection and rendering accordingly. This is particularly important given that various versions of browsers support various levels of HTML5/JavaScript and limiting the functionality based on just browser version would miss out on stuff that the browser actually supports.
here below is the code snippet for checking the video playing capabilities of the browser
Video Codec Detection
<script type="text/javascript">
var player = document.getElementById('myVideo');
alert("Is <video> supported? " +
(player.canPlayType != null));
if (player.canPlayType) {
alert("Is an unknown format supported? " +
player.canPlayType('NoWay/VidXF'));
alert("Is mp4 supported? " +
player.canPlayType('video/mp4'));
alert("Is H.264 Baseline supported? " +
player.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'));
}
</script>
精彩评论