TAILIEUCHUNG - THE BOOK OF JAVASCRIPT, 2ND EDITION p2

Các trình duyệt nhiều để mất tinh thần của các nhà phát triển web ở khắp mọi nơi, khác nhau thực hiện JavaScript và HTML trong những cách hơi khác nhau. Nó sẽ không thể tuyệt vời nếu bạn có thể phục vụ mỗi trình duyệt một cách chính xác nội dung nó có thể hiểu được? | GIVING THE BROWSERS WHAT THEY WANT Much to the dismay of web developers everywhere different browsers implement JavaScript and HTML in slightly different ways. Wouldn t it be great if you could serve each browser exactly the content it could understand Fortunately you can use JavaScript to determine which browser a visitor is using. You can then use that information to deliver content suitable for that specific browser either by redirecting the visitor to a page containing content especially tailored for that browser or by writing your JavaScripts so that the same page does different things depending on the browser looking at it. This chapter covers the three topics you need to understand to deliver browser-specific pages using redirects How to determine which browser your visitor is using How to redirect the visitor to other pages automatically How to send the visitor to the page you want depending on which browser he or she is using As in Chapter 2 while learning how to handle an important web authoring task you ll also be introduced to fundamental elements of the JavaScript language in this case if-then statements and related methods for implementing logical decision making in your scripts. Let s first talk about determining which browser a visitor is using. A Real-World Example of Browser Detection Before we get into the details of how browser detection works let s look at a real-world example. Netscape the company that brought you the Netscape Navigator browser has a complicated home page with lots of interesting features. They ve taken great pains to make their home page look good to most browsers including early versions of their own browser. If you compare the Netscape home page seen with Netscape Navigator 4 Figure 3-1 to the page seen using Navigator 8 Figure 3-2 you ll notice some subtle differences. Among other things the news blurb at the bottom of Figure 3-2 has a little navigational element in the lower-right corner. Clicking the numbers in that .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.