240 likes | 365 Views
Building Add- Ons that Work Cross-Browser Joshua Allen <joshuaa@microsoft.com>. From Firefox to IE. Why Did You Start With Firefox?. Building for IE is Difficult More Controlled Test Bed Mike Arrington Uses Macintosh Your Developers Used Firebug. Why Port to IE?. Bigger Market Share
E N D
Building Add-Ons that Work Cross-Browser Joshua Allen <joshuaa@microsoft.com> From Firefox to IE
Why Did You Start With Firefox? • Building for IE is Difficult • More Controlled Test Bed • Mike Arrington Uses Macintosh • Your Developers Used Firebug
Why Port to IE? • Bigger Market Share • More Mainstream Users • Higher Bar to Entry for Your Competitors
The Web is About Interop • Users: Things Work The Same on All Browsers • Developers: My Skills Work on All Browsers • Consider Starting With Both Browsers
Creating Your Add-On • Design • Build • Test • Deploy
Design • Use Web Standards • Consider Slices and Accelerators
An Idealistic Example: Oomph • Detect Microformats from Browser • Cross-Browser Tag for Page Owners • IE Toolbar – NOT for Firefox, Safari, etc. • Export to Outlook, Google Calendar, etc. • http://visitmix.com/lab/Oomph • http://codeplex.com/Oomph
The Purple is Your Code • http://msdn.microsoft.com/en-us/library/aa769764.aspx
Adding Oomph to IE <script language="javascript" type="text/javascript" src="https://visitmix.com/labs/oomph/1.0/client/oomph.min.js"> </script> • Adding to Google Chrome with User Script • The same code in IE
ZOMG!! C++?!? Oh, but it’s more than C++. You get ATL/COM!!!
Can I use C# (or Python, etc.)? • Only one version of CLR per iexplore.exe • That means CLR 1.1 or 2.0 • Pay attention to breaking changes • Test both versions • Fail if wrong CLR version • You still need to interop with the C++ interfaces
Like XUL, Only in C++ • IWebBrowser2 • IHTMLDocument2 • DWebBrowserEvents2 • HTMLDocumentEvents2
Loading Your Add-On • Finds Your DLL in Registry and Loads it • In-Process With Iexplore.exe • One Instance Per Tab • First DllMain, then SetSite
Step-By-Step • http://visitmix.com/university/lab_ieextensions.doc • http://codeplex.com/Oomph
Sidebar UI • We Call it “Vertical Explorer Bar” or “Web Band” • Default is Win32, but You Should Use WebOC • WebOC is our Rendering Engine, Like Gecko • Use Web Standards in WebOC for UI • Sample Project
Toolbar UI • Buttons: No Code Needed! But… • No Dynamic UI • No Split Button • No Forced Ordering • Tool Bands • All Win32
Protected Mode • Low Integrity (iexplore.exe): Cannot Modify Anything but Temporary Internet Files Folder • Medium Integrity (default): Can Modify Anything Except Program and System Folders and Other Users’ Data • High Integrity (installers): Can Modify Anything
Common Issues • Access System Resources from Add-On • Use DCOM to user-mode broker • Call Your Add-On from JavaScript • Use ActiveX Control • Like XPCOM • Step-by-Step Lab • Access System Resources from JavaScript • ActiveX + DCOM
Common Issues • Web Services • Use Web Standards from AJAX (JSON, XML) • Persistence • Use cookies, Server State, or Plugin Library • Detect Tab Switching • Background Processing – Call Service Via DCOM
Common Issues • Mixed Content • Local Machine Zone (LMZ) is Separate. Use (Mark of the Web) MOTW to Force Local Web Pages into Internet Zone • Non-SSL on SSL Throws Error: Use SSL, or don’t MIX • Intercept Networking Events (Headers, Cookies) • Can’t Do It • Security Companies Write Proxies
Forums • http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=924&SiteID=1 • IE Team Active on Forums • Forums Being Migrated
Testing and Debugging • Use IE8 on Vista • Most Restrictive Security • Good Developer Tools • IE7 Switcher • Visual Studio Elevated to Administrator • OutputDebugString • Test With Popular Toolbars Loaded
Deployment • Use WiX v3 to create MSI • Need to Deploy DLL and Registry • Don’t do DllRegisterServer anymore • http://codeplex.com/Oomph • Per-User ActiveX