When creating Web applications,the first page a user sees is the login page. Most login pages have at least two fields: username and password.The purpose,of course,is to keep unauthorized users out.But what about those users who don’t meet the minimum browser and system requirements for the application?They really should not be allowed to log in.The solution that many developers choose is to make a login page that does browser detection before the user is even able to enter a username, password, or any other information.For this purpose,the browser and operating system detection script works beautifully.
The highlighted section of code contains the actual error message.Note that the entire error message is contained within a <div/> named divError. Also note that divError has an absolute position.This is important because the login form lies directly over the error message.However,the login form is invisible at load time and is only shown if appropriate. Before getting to that, add the code for the login form right after the error message:This Web application requires one of the following:
Now that the pieces are in place,you can use the detection script to check for the appropriate browsers and operating systems.
The code should show the login form and hide the error message if the user has fulfilled the requirements:
This code snippet uses the style extensions of the DOM to set the CSS visibility property of each <div/>.Accessing the CSS style of elements using script is covered fully in Chapter 10,“Advanced DOM Techniques.”This code should be executed when the document is loaded,so it should be assigned to the window.onload event handler.(Don’t worry too much about this now; events and event handlers are discussed in the next chapter.)
This should be place in divError just after the <ul/> element:
This Web application requires one of the following:
Now,all cases are covered. If the user is accessing the page with an incorrect browser, the error message is displayed because the script will not hide it to show the login form.
If the correct browser and platform are being used, the script is executed when the page is loaded,
hiding the error message(so the user never sees it) and displaying the login form
This is an important part of Web application usability.Many sites provide a generic login form that any browser can use even though the internal functionality requires a specific browser. This login pageensures that users of the Web application have the minimum requirements necessary to access all its features without making a trip back to the server.
Java Script Related Tutorials
|Adv Java Tutorial||Core Java Tutorial|
|Java-Springs Tutorial||Java Servlets Tutorial|
|EJB(Enterprise JavaBeans) Tutorial||JavaServer Faces (JSF) Tutorial|
|Java Swing Tutorial||Java Tutorial|
|JavaMail API Tutorial||Java 8 Tutorial|
|Java XML Tutorial||Java Bean Utils Tutorial|
|The Java Debugger (JDB) Tutorial||Java.math Package Tutorial|
Java Script Related Interview Questions
|Java Script Interview Questions||Adv Java Interview Questions|
|Core Java Interview Questions||Java-Springs Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JavaServer Faces (JSF) Interview Questions||Java Swing Interview Questions|
|Java 8 Interview Questions||Java XML Interview Questions|
|JavaFX Interview Questions||The Java Debugger (JDB) Interview Questions|
Java Script Related Practice Tests
|Java Script Practice Tests||Adv Java Practice Tests|
|Core Java Practice Tests||Java-Springs Practice Tests|
|Java Servlets Practice Tests||EJB(Enterprise JavaBeans) Practice Tests|
|JavaServer Faces (JSF) Practice Tests||Java 8 Practice Tests|
Java Script Tutorial
Browser And Operating System Detection
All About Events
Advanced Dom Techniques
Forms And Data Integrity
Drag And Drop
Interacting With Plugins
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.