You are previewing Pro Internet Explorer 8 & 9 Development: Developing Powerful Applications for The Next Generation of IE.
O'Reilly logo
Pro Internet Explorer 8 & 9 Development: Developing Powerful Applications for The Next Generation of IE

Book Description

This book is an in-depth guide to writing applications that embrace and extend the new features and capabilities of Windows Internet Explorer 8 and 9. With solid instruction, hands-on examples, and expert insight direct from the source into extending the browser, you'll learn how to create and maintain powerful applications for Microsoft's next-generation Internet platform. Join author Matthew Crowley as you discover how to take advantage of new features like accelerators, Web Slices, and search providers, and create intense web experiences for the browser that ships by default with the popular Windows 7 operating system.

If you're interested in creating and shipping high-quality, feature-rich applications for the Web, Pro Internet Explorer 8 and 9 Development is the only resource you need.

Table of Contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Preface
    1. What Will You Learn?
    2. Who Should Read This Book?
    3. How Is the Book Structured?
    4. Additional Resources
  6. 1. Internet Explorer Architecture
    1. 1.1. Application Architecture and Dependencies
      1. 1.1.1. Command-Line Parameters
      2. 1.1.2. Processor Support
      3. 1.1.3. Protected Mode (Low-Rights IE)
      4. 1.1.4. Loosely Coupled Internet Explorer
        1. 1.1.4.1. Shared UI and Virtual Tabs
        2. 1.1.4.2. Crash Recovery
    2. 1.2. Browser Frame, Tabs, and UI
      1. 1.2.1. Search and Navigation
        1. 1.2.1.1. Address Bar and Navigation UI
        2. 1.2.1.2. The Smart Address Bar
        3. 1.2.1.3. Search Providers, Visual Search Providers, and the OpenSearch Specification
      2. 1.2.2. Printing
      3. 1.2.3. Tab Management
      4. 1.2.4. Favorites Center, Feeds, and History UI
        1. 1.2.4.1. Favorites UI and Favorites Bar
        2. 1.2.4.2. Feeds
        3. 1.2.4.3. History UI
      5. 1.2.5. Status and Notifications
        1. 1.2.5.1. Address Bar Notifications
        2. 1.2.5.2. Status Bar
        3. 1.2.5.3. Information Bar
        4. 1.2.5.4. Balloon Tips (Notifications)
        5. 1.2.5.5. Modal Dialogs
        6. 1.2.5.6. Full-Page Notifications
      6. 1.2.6. Frame and Tab Extensibility
        1. 1.2.6.1. Toolbars
        2. 1.2.6.2. Explorer Bars
        3. 1.2.6.3. Accelerators and the OpenService Specification
        4. 1.2.6.4. Web Slices
        5. 1.2.6.5. Bookmarklets
        6. 1.2.6.6. Menu Extensions
        7. 1.2.6.7. Toolbar Buttons
        8. 1.2.6.8. Browser Helper Objects
    3. 1.3. Developer Tools
      1. 1.3.1. Script Errors and View Source
    4. 1.4. Shell Document View
      1. 1.4.1. The Travel Log and Shared Features
      2. 1.4.2. Trident (MSHTML)
      3. 1.4.3. Third-Party and Custom Document Objects
    5. 1.5. Trident Layout and Rendering Engine
      1. 1.5.1. Parser Subsystem
      2. 1.5.2. Document Modes and Compatibility View
      3. 1.5.3. Core Document Subsystem
      4. 1.5.4. Text, Layout, and Rendering Subsystem
      5. 1.5.5. Object Model Subsystem
        1. 1.5.5.1. IE Dynamic HTML Object Model and W3C Document Object Model
        2. 1.5.5.2. Script Engine Interfacing (JScript.dll, VBScript.dll)
        3. 1.5.5.3. Cross-Domain Request Objects (XMLHTTP, XMLHTTPRequest)
        4. 1.5.5.4. Accessibility
      6. 1.5.6. Component Model Subsystem
        1. 1.5.6.1. Scripted and Binary Behaviors
        2. 1.5.6.2. ActiveX Controls
      7. 1.5.7. Editing Subsystem
    6. 1.6. Networking and Zones
      1. 1.6.1. URLMon
        1. 1.6.1.1. Zones and Security Managers
        2. 1.6.1.2. Pluggable Protocol Handlers
      2. 1.6.2. WinINET
    7. 1.7. Security, Trust, and Privacy Architecture
      1. 1.7.1. Security UI and Feedback Mechanisms
        1. 1.7.1.1. Information Bar
        2. 1.7.1.2. Badges
        3. 1.7.1.3. Full-Page Notifications
        4. 1.7.1.4. Protected Mode and UAC Dialogs
        5. 1.7.1.5. Status Bar Entry Points
      2. 1.7.2. Application Integrity and Browser Defenses
        1. 1.7.2.1. Protected Mode and Zones
        2. 1.7.2.2. DEP/NX and ASLR
      3. 1.7.3. Extension Integrity Defenses
        1. 1.7.3.1. ActiveX Safe for Initialization and Safe for Scripting
        2. 1.7.3.2. ActiveX Opt-In
        3. 1.7.3.3. ATL SiteLock Template and Per-Site ActiveX
        4. 1.7.3.4. Per-User (Non-Admin) ActiveX
        5. 1.7.3.5. Killbits and Phoenix Bits
        6. 1.7.3.6. Compatibility Warnings
      4. 1.7.4. Privacy and Social Engineering Protections
        1. 1.7.4.1. Window and Frame Restrictions
        2. 1.7.4.2. Malware and Phishing Filters
        3. 1.7.4.3. Platform for Privacy Preferences
        4. 1.7.4.4. Pop-Up Blocker
        5. 1.7.4.5. SSL, EV-SSL, and Identify Information
        6. 1.7.4.6. Domain Highlighting and IDN Spoofing Notifications
        7. 1.7.4.7. Cross-Domain Requests and postMessage
        8. 1.7.4.8. InPrivate Browsing and InPrivate Filtering
        9. 1.7.4.9. Cross-Site Scripting Filter
      5. 1.7.5. High-Integrity Brokers
        1. 1.7.5.1. ActiveX Installation Broker (ieinstal.exe)
        2. 1.7.5.2. ActiveX Installer Service (axinstsv.exe)
    8. 1.8. Hosting and Reuse
      1. 1.8.1. MSHTML
      2. 1.8.2. WebBrowser Control
      3. 1.8.3. HTML Applications
      4. 1.8.4. Scripting Interfaces and API Usage
    9. 1.9. Application Management Tools
      1. 1.9.1. Internet Explorer Administration Kit
      2. 1.9.2. Setup and the Windows 7 Uninstaller
      3. 1.9.3. Windows Error Reporting, Event Logging Infrastructure, and the Customer Experience Improvement Program
      4. 1.9.4. Windows 7 Troubleshooter
      5. 1.9.5. Default Programs
      6. 1.9.6. Online Services
    10. 1.10. Settings Management and Feature Controls
      1. 1.10.1. Internet Options Control Panel (inetcpl.cpl)
      2. 1.10.2. Reset Internet Explorer Settings
      3. 1.10.3. Manage Add-Ons
      4. 1.10.4. Group Policy
      5. 1.10.5. Feature Control Keys
    11. 1.11. Summary
  7. 2. Interoperability and Compatibility
    1. 2.1. Standards Support and Interoperability
      1. 2.1.1. HTML 4.01, HTML 5, and DOM Spec Support Improvements
    2. 2.2. Document Modes and Versioning
      1. 2.2.1. Quirks Mode, Document Modes, and X-UA-Compatible
      2. 2.2.2. Document Modes
      3. 2.2.3. Targeting Quirks Mode and Document Modes in Markup
      4. 2.2.4. Targeting Document Modes from the Server Side
        1. 2.2.4.1. Adding the X-UA-Compatible Header to IIS
        2. 2.2.4.2. Adding the X-UA-Compatible Header to Apache
      5. 2.2.5. Feature Controls for Document Modes
      6. 2.2.6. Differences Between IE 7 Standards Mode and True IE 7
    3. 2.3. Compatibility View
      1. 2.3.1. The Microsoft Compatibility View List
      2. 2.3.2. Controlling Compatibility Settings
    4. 2.4. Version Targeting
      1. 2.4.1. Version Targeting Using Conditional Comments
      2. 2.4.2. User Agent String Sniffing Using JavaScript
      3. 2.4.3. Compatibility View and the UA String
    5. 2.5. The Web Developer's Dilemma
    6. 2.6. Summary
  8. 3. Enriching Web Applications with AJAX and JSON
    1. 3.1. The XMLHttpRequest Object
      1. 3.1.1. The XMLHTTP Library and XMLHttpRequest Object
      2. 3.1.2. Native XMLHttpRequest
      3. 3.1.3. Cross-Browser AJAX Compatibility
    2. 3.2. Scripting and DOM Improvements
      1. 3.2.1. Native JSON Support
      2. 3.2.2. String Sanitization with toStaticHTML
      3. 3.2.3. Standards Compliance Improvements
        1. 3.2.3.1. Handling the addEventListener Method
        2. 3.2.3.2. Case Sensitivity in getElementById
        3. 3.2.3.3. Attribute Object Changes
          1. 3.2.3.3.1. Uninitialized Values and the Attributes Collection
          2. 3.2.3.3.2. Attributes Collection Ordering
          3. 3.2.3.3.3. Accessing an Element's Class Information
    3. 3.3. Persisting Data with DOM Storage
      1. 3.3.1. DOM Storage and Subdomains
      2. 3.3.2. Securing Persisted Storage
      3. 3.3.3. Moving towards HTML 5 Storage
    4. 3.4. Networking and Connectivity
      1. 3.4.1. Online and Offline Events
      2. 3.4.2. XMLHttpRequest Timeout Events
      3. 3.4.3. AJAX Navigation Events
      4. 3.4.4. Concurrent Connections
    5. 3.5. Communicating Across Pages and Domains
      1. 3.5.1. Cross-Domain Requests
        1. 3.5.1.1. Building the Request
        2. 3.5.1.2. Building the Response
        3. 3.5.1.3. Putting it Together: The Request/Response Sequence
        4. 3.5.1.4. Building Interoperable Cross-Domain Requests
      2. 3.5.2. Cross Frame Messaging with postMessage()
      3. 3.5.3. Tips and Tricks for Secure Communication
    6. 3.6. Summary
  9. 4. Connecting Services with Accelerators
    1. 4.1. The What and Why of Accelerators
    2. 4.2. User Experience and Data Flow
    3. 4.3. The OpenService XML Schema
      1. 4.3.1. Tags
      2. 4.3.2. Variables
    4. 4.4. Creating Basic Accelerators
      1. 4.4.1. Constructing an Accelerator's XML File
      2. 4.4.2. Constructing a Web Service Handler
    5. 4.5. Handling Accelerator Contexts
      1. 4.5.1. Using the Selection Context
      2. 4.5.2. Using the Link Context
      3. 4.5.3. Using the Document Context
    6. 4.6. Implementing Previews
    7. 4.7. Installation and Deployment
      1. 4.7.1. Installing and Deploying via JavaScript
        1. 4.7.1.1. Checking for Installed Accelerators
      2. 4.7.2. Installing and Deploying via Desktop Applications
        1. 4.7.2.1. Using the OpenService COM Interfaces
        2. 4.7.2.2. Accelerators and the Registry
      3. 4.7.3. Working with Categories and Defaults
    8. 4.8. Managing Accelerators
    9. 4.9. Advanced Topics
      1. 4.9.1. Updating Installed Accelerators
      2. 4.9.2. Building Rich Previews
      3. 4.9.3. Localizing Accelerators
      4. 4.9.4. Cross-Browser Integration
    10. 4.10. Best Practices for Building Accelerators
      1. 4.10.1. Providing Relevant Information
      2. 4.10.2. Designing Secure Accelerators
      3. 4.10.3. Designing Performant Accelerators
      4. 4.10.4. Designing Preview Web Pages
      5. 4.10.5. An Accelerator Design Checklist
    11. 4.11. Summary
  10. 5. Debugging and Inspecting Pages with Developer Tools
    1. 5.1. Navigating the IE Developer Tools
      1. 5.1.1. View Source
      2. 5.1.2. The File Menu
    2. 5.2. Inspecting Markup
      1. 5.2.1. The HTML Tab and the DOM Explorer
      2. 5.2.2. The Attributes Pane
      3. 5.2.3. The Find, View, and Outline Menus
      4. 5.2.4. Exporting Changes
      5. 5.2.5. Markup Inspection in Action
    3. 5.3. Inspecting Layout and Styles
      1. 5.3.1. The Style Pane
      2. 5.3.2. The Trace Styles Pane
      3. 5.3.3. The Layout Pane
      4. 5.3.4. The Attributes Pane
      5. 5.3.5. The CSS Tab
      6. 5.3.6. CSS and Layout Inspection in Action
    4. 5.4. Using the Extended Toolset
      1. 5.4.1. The Disable Menu
      2. 5.4.2. The Images Menu
      3. 5.4.3. The Tools Menu
      4. 5.4.4. The Extended Toolset in Action
    5. 5.5. Testing for Compatibility and Interoperability
      1. 5.5.1. The Browser Mode and Document Mode Menus
      2. 5.5.2. The Validate Menu
    6. 5.6. Debugging JavaScript
      1. 5.6.1. The Script Tab
      2. 5.6.2. The Source Pane
      3. 5.6.3. Breakpoints and the Breakpoints Pane
      4. 5.6.4. The Locals, Watch, and Call Stack Panes
      5. 5.6.5. The Debugging Console Pane and the console Object
      6. 5.6.6. JavaScript Debugging in Action
    7. 5.7. JavaScript Measurement and Optimization
      1. 5.7.1. The JavaScript Profiler
      2. 5.7.2. The Profiler UI
      3. 5.7.3. Profile Views
      4. 5.7.4. Exporting Data
      5. 5.7.5. JavaScript Performance Testing in Action
    8. 5.8. Managing Cookies and the Cache
    9. 5.9. Tips for Debugging and Inspecting Web Sites
    10. 5.10. Summary
  11. 6. Scripting with Mutable DOM Prototypes
    1. 6.1. A Primer: Prototypes, Properties, and the DOM
      1. 6.1.1. Prototypes
      2. 6.1.2. Properties (Getters and Setters)
      3. 6.1.3. JavaScript and the DOM
    2. 6.2. Mutable Prototypes and Properties in IE 8
      1. 6.2.1. Manipulating DOM Objects
        1. 6.2.1.1. Adding New Functions
        2. 6.2.1.2. Accessing and Storing Built-In Functions
        3. 6.2.1.3. Wrapping Existing Functions
        4. 6.2.1.4. Deleting Custom Functions
      2. 6.2.2. Manipulating DOM Object Get and Set Properties
        1. 6.2.2.1. Creating New Properties
        2. 6.2.2.2. Accessing and Storing Built-In Properties
        3. 6.2.2.3. Wrapping Existing Properties
        4. 6.2.2.4. Deleting Custom Properties
        5. 6.2.2.5. Using Property Descriptors
    3. 6.3. IE Improvements in Practice
      1. 6.3.1. Downlevel IE Compatibility
        1. 6.3.1.1. Example: Reenabling Support for the className Attribute
      2. 6.3.2. Cross-Browser Interoperability
        1. 6.3.2.1. Example: Supporting Both textContent and innerText
      3. 6.3.3. Security and Sanitization
        1. 6.3.3.1. Example: Disabling document.write
        2. 6.3.3.2. Example: Automatically Sanitizing innerHTML Reads and Writes
      4. 6.3.4. Input Validation
        1. 6.3.4.1. Example: Input Validation for Forms
    4. 6.4. Summary
  12. 7. Debugging and Inspecting Pages with Fiddler
    1. 7.1. Getting Started with Fiddler
      1. 7.1.1. Installing and Running Fiddler
      2. 7.1.2. Navigating the Fiddler User Interface
      3. 7.1.3. Scripting Fiddler with Rules
    2. 7.2. Viewing and Inspecting Sessions
      1. 7.2.1. Deciphering the Session List
      2. 7.2.2. Inspecting the Request-Response Sequence
      3. 7.2.3. Comparing Sessions
    3. 7.3. Filtering Sessions
      1. 7.3.1. Using the Top-Level Filter Commands
      2. 7.3.2. Using the Filters Tab
    4. 7.4. Debugging and Manipulating Sessions
      1. 7.4.1. Using the Request Builder
      2. 7.4.2. Using the Filters Tab to Modify Session Data
      3. 7.4.3. Setting and Using Breakpoints
    5. 7.5. Analyzing Site Performance
      1. 7.5.1. Quantifying Request Items, Types, and Times
      2. 7.5.2. Evaluating Cache Performance
      3. 7.5.3. Optimizing Compression Settings
      4. 7.5.4. Simulating Performance Scenarios Using Built-In Rules
    6. 7.6. Using Fiddler to Decrypt HTTPS Traffic
    7. 7.7. Grabbing Simple Captures with FiddlerCap
      1. 7.7.1. Installing and Running FiddlerCap
      2. 7.7.2. Capturing Traffic with FiddlerCap
    8. 7.8. Summary
  13. 8. Content Syndication with Web Slices
    1. 8.1. Basics of Web Slices
      1. 8.1.1. Web Slice Structure: The hAtom Microformat
    2. 8.2. Designing and Deploying Basic Web Slices
      1. 8.2.1. Structuring and Creating a Web Slice
      2. 8.2.2. Installing and Viewing Web Slices
      3. 8.2.3. Managing Web Slices
    3. 8.3. Update and Expiry Management
      1. 8.3.1. Defining Update Intervals with TTL
      2. 8.3.2. Defining Expiration with the endtime Selector
    4. 8.4. Using CSS Styles and Stylesheets
      1. 8.4.1. Inline Styles and In-Document Stylesheets
      2. 8.4.2. Linked and Imported Styles
    5. 8.5. Alternative Sources
      1. 8.5.1. Alternative Update Source
      2. 8.5.2. Alternative Display Sources
        1. 8.5.2.1. Alternative Navigation Target
    6. 8.6. Authentication
      1. 8.6.1. Basic and Digest Authentication
      2. 8.6.2. Cookie-Based Authentication
    7. 8.7. Advanced Topics
      1. 8.7.1. Specifying a Page's Default Web Slice
      2. 8.7.2. Script-Based Installation
      3. 8.7.3. Disabling In-Document Web Slice Advertisement
    8. 8.8. Summary
  14. 9. Building Search Provider and Search Suggestion Extensions
    1. 9.1. Understanding Search Providers
    2. 9.2. The OpenSearch Description Format, JSON Search Suggestions, and XML Search Suggestions Specifications
      1. 9.2.1. OpenSearch Description FormatSpecification
        1. 9.2.1.1. OpenSearch Description Format Tags
        2. 9.2.1.2. Template Variables for the <Url> Tag
        3. 9.2.1.3. OpenSearch Extensions
      2. 9.2.2. JSON Search Suggestion Extension
      3. 9.2.3. XML Search Suggestion Extension
        1. 9.2.3.1. XML Search Suggestion Tags
    3. 9.3. Building a Basic Search Provider
    4. 9.4. Installing and Using Search Providers
    5. 9.5. Advertising Search Providers
    6. 9.6. Managing Search Providers
      1. 9.6.1. Returning Visual Suggestions with XML
    7. 9.7. Advanced Topics
      1. 9.7.1. Building Cross-Browser Search Providers
      2. 9.7.2. Adding Search Providers to the IE Add-Ons Gallery
      3. 9.7.3. User Preference Protection
    8. 9.8. Summary
  15. 10. Building Lightweight Buttons and Menu Extensions
    1. 10.1. Understanding Lightweight IE Extensions
    2. 10.2. Adding Toolbar Buttons
      1. 10.2.1. Common Toolbar Button Properties
      2. 10.2.2. Running Script Using a Toolbar Button
      3. 10.2.3. Launching an Executable via a Toolbar Button
      4. 10.2.4. Invoking COM Objects via a Toolbar Button
      5. 10.2.5. Opening Explorer Bars with Toolbar Buttons
    3. 10.3. Extending the Tools and Help Menus
      1. 10.3.1. Common Menu Item Properties
      2. 10.3.2. Running Script Using a Menu Item
      3. 10.3.3. Launching an Executable via a Menu Item
    4. 10.4. Adding Entries to the In-Page Context Menu
      1. 10.4.1. Understanding the Context Menu Registry Structure
      2. 10.4.2. Example: Browser Selection Context Menu Extension
      3. 10.4.3. Turning Off the Context Menu
    5. 10.5. Creating Context Menus with JavaScript
    6. 10.6. Summary
  16. 11. Developing Applications with the WebBrowser Control
    1. 11.1. Building a Simple WebBrowser Application
      1. 11.1.1. Preparing to Use the WebBrowser Control
      2. 11.1.2. Creating an Instance of the WebBrowser Control (AxWebBrowser)
      3. 11.1.3. Handling Basic Events
    2. 11.2. Accessing the Object Model
      1. 11.2.1. Attaching to Document and Window Objects
      2. 11.2.2. Accessing the Browser Object Model
      3. 11.2.3. Sinking Object Model Events
    3. 11.3. Achieving Tight Integration with IE
      1. 11.3.1. Setting Up the Application
      2. 11.3.2. Integrating WebBrowser Events with the IE UI
      3. 11.3.3. Mimicking Window Behavior of IE
      4. 11.3.4. Surfacing and Executing OLE Commands
    4. 11.4. Summary
  17. 12. Enhancing Page Content with Managed ActiveX Controls
    1. 12.1. Getting to Know ActiveX Controls
    2. 12.2. Architecting a Basic Control in .NET
      1. 12.2.1. Designing the Public Interface
      2. 12.2.2. Building the Control
      3. 12.2.3. Signing the Control
      4. 12.2.4. Running the Control
    3. 12.3. Constructing UIs
      1. 12.3.1. Adding a UI to a Managed Control
      2. 12.3.2. Setting a Control's OLE UI Flags
    4. 12.4. Exposing Events to ActiveX Hosts
      1. 12.4.1. Creating the Event Interface
    5. 12.5. Practicing Safe ActiveX with IObjectSafety
      1. 12.5.1. Staying Safe in the Great IUnknown
      2. 12.5.2. Implementing IObjectSafety
    6. 12.6. Looking At Alternative Platforms and Technologies
    7. 12.7. Summary
  18. 13. Building In-Process Extensions with Browser Helper Objects
    1. 13.1. Understanding BHOs
    2. 13.2. Building a Generic BHO
    3. 13.3. Registering and Running BHOs
    4. 13.4. Sinking Browser Events
    5. 13.5. Summary
  19. 14. Extending the Browser Frame Using Band Objects
    1. 14.1. Understanding Band Objects
    2. 14.2. Building a Generic Band Object
    3. 14.3. Registering Band Objects
    4. 14.4. Constructing a Toolbar
    5. 14.5. Constructing a Vertical Explorer Bar
    6. 14.6. Constructing a Horizontal Explorer Bar
    7. 14.7. Summary
  20. 15. Scripting and Automating Internet Explorer
    1. 15.1. Using IE with the Command Line
      1. 15.1.1. Getting to Know the IE Command Line
      2. 15.1.2. Changing IE Registry Settings
      3. 15.1.3. Invoking IE APIs Using RunDLL32
    2. 15.2. Writing Basic Scripts for IE
      1. 15.2.1. Creating IE Objects with the Windows Scripting Host
      2. 15.2.2. Creating IE Objects with PowerShell
      3. 15.2.3. Sinking Events Using VBScript and CreateObject
      4. 15.2.4. Learning Common IE Scripting Techniques by Example
        1. 15.2.4.1. Setting Basic Window Properties (VBScript)
        2. 15.2.4.2. Opening Multiple Tabs in a Single Window (JScript)
        3. 15.2.4.3. Accessing the Document Object and Finding All Links (VBScript)
        4. 15.2.4.4. Setting a Home Page Using Windows Management Instrumentation (VBScript)
    3. 15.3. Summary