mwd1001 – website production web browsers week 11
Post on 21-Dec-2015
215 views
TRANSCRIPT
MWD1001 – Website Production
Web Browsers
Week 11
MWD1001 – Website Production
Who cares about browsers?
Most people use Internet Explorer Tech savvy use Firefox A few people use Opera It doesn’t really matter any more!
MWD1001 – Website Production
Straw poll
IE6: IE7: Firefox: Opera: Other:
MWD1001 – Website Production
Main Browser Families
MWD1001 – Website Production
Microsoft Internet Explorer (IE)
Multiple versions in regular use– Currently transitioning from 6 to 7
Tight integration with Windows operating system
Dominant browser for corporate and home users
Trident rendering engine used by Outlook Express, winamp, AOL browser
MWD1001 – Website Production
Gecko
The rendering technology behind Firefox, Flock, Camino, Seamonkey, …
Open source technology Cross-platform, runs on Windows,
Mac, Linux/Unix
MWD1001 – Website Production
Opera
Innovative web browser Low market share compared to big
two on the desktop Very well represented in
smartphones and mobile apps Presto rendering engine
MWD1001 – Website Production
Safari/Konqueror
Safari is the browser Apple ship on all Macs, now on Windows and iPhone
Konqueror runs on Linux as part of the KDE environment
Both derived from Webkit engine Said to be very standards compliant
MWD1001 – Website Production
Brand New – Chrome
Google launched their own browser last month
Based on Webkit engine Optimised for JavaScript and web
apps PC only right now
MWD1001 – Website Production
0%
20%
40%
60%
80%
100%
120%
Jan-02
May-02
Sep-02
Jan-03
May-03
Sep-03
Jan-04
May-04
Sep-04
Jan-05
May-05
Sep-05
Jan-06
May-06
Sep-06
Jan-07
May-07
Sep-07
Jan-08
May-08
Sep-08
AOL
Chrome
Opera
Safari
Firefox
Mozilla
IE7
IE6
IE5
Market Share
Source: w3schools.com Oct 2008
MWD1001 – Website Production
Why does it matter
MWD1001 – Website Production
W3C Standards
World Wide Web Consortium sets standards for HTML, CSS
Can browsers pass the ACID Test? Internet Explorer used to be the de
facto standard when it had > 90% market share
No current browser fully conforms to all current standards
Cannot rely on features to be present– Always aim to degrade gracefully
MWD1001 – Website Production
ActiveX
IE supports ActiveX controls on Windows– Can be used to implement Client-side code– Not cross-platform– Associated with security risks
Most browser support Flash as an alternative
Advanced JavaScript (AJAX) code can be implemented client-side
MWD1001 – Website Production
Authentication
Browsers and web servers support different authentication schemes
Apache offers Basic and Digest Authentication
IIS offers Basic, Cookie and NTLM NTLM only available in IE on Windows
/adamisherwood /authentication
MWD1001 – Website Production
What is NTLM
NTLM passes the user’s Windows login credentials to the server
Using IE, users are not challenged for login at all if their acct is authorised
Useful in a corporate environment where browsers and user accounts are controlled
MWD1001 – Website Production
JavaScript and DOM
Since its introduction JavaScript has had compatibility issues
Often through competition by features Events are not supported by all
browsers– E.g IE allows onClick on Image tags,
Netscape didn’t CSS Properties such as position: float;
not in IE6
MWD1001 – Website Production
JavaScript and AJAX
Writing code is harder than it needs to be
Have to anticipate compatibility issues
Need to write more than one version of code
MWD1001 – Website Production
How can you tell?
MWD1001 – Website Production
Server-side
User-agent string passed to server as HTTP environment variable
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
May be spoofed– Useful if you maintain different versions– Important to check for authentication
MWD1001 – Website Production
Client Side
Much more important for client-side programming
If you rely on a feature which turns out to be missing your app fails
JavaScript methods exist to check for IE or NS versions– May be spoofed
Better to use the black art of browser sniffing
MWD1001 – Website Production
Browser Sniffing
Don’t actually care which browser! Need to know whether function supported IE has a document.all array containing all
page elements if (document.all) {
//some IE specific code}
More advanced code relies on getElementById() function
/adamisherwood /sniffing
MWD1001 – Website Production
Summary
Browser market fragmented Functionality and capability varies Cannot rely on standards Fail Gracefully