Multi-Browser Viewer Logo

How to Prevent Cross-Browser Compatibility problems

clock October 12, 2009 10:30 by author

Many of the support queries we receive relates to how can you ensure that your web page design is cross browser compatible. In other words instead of going through the entire development process, then testing my design in different browsers, what standard practices should I follow to ensure web site will render correctly once it is completed.

Well, unfortunately there is no foo proof method off course, but here are a few helpful tips/best practices that should get you pretty close at least.

First off - What is a web browser??

Simple question I know, but many people still get confused to exactly what a browser is and how it functions. An Internet browser (IE, Firefox, Safari, Opera and Google Chrome for example) is nothing more than a software application, similar to a text editor, anti-virus software or a computer game. Some of the confusion comes in because IE is embedded or very much part of the Microsoft Operating system(although Microsoft is starting to clearly separate the browser from the OS). A browser is NOT a search engine and it is NOT a website. A web browser renders/displays web pages that you visit/browse. Web browsers use different rendering engines, which means HTML, CSS and other code gets interpreted and thus differently by different web browsers. And that of course where the problem lies for website owners and web designers....Sure there are supposed standards like the W3C and such, which are supposedly followed by everyone, but for various reasons, which fall outside the scope of this article, the problem remains.

Cross-Browser Compatibility Best Practices

1. Know you web user - The first thing you need to do is understand who your customers and/or web browsers will be. In other words if you are developing for a closed environment like an intranet, then maybe 90% of your users will be Internet Explorer based or if it a design firm that only uses Apple Mac machines then maybe all the traffic is exclusively Safari. Bottom line is make sure you know what the most important browser demographic is for your web application. If you have no idea, industry browser usage statistics are available in the blog post here. I would recommend however that you use a tool like Google analytics to determine the usage statistics for your own site, as the numbers can vary substantially from target market to target market.

Why is it important to know what web browsers are most important for you? Well, it helps you ensure that you optimize your design and/or development for that particular browser and if you do have a cross-browser compatibility issue, you'll know exactly how many users are affected by it.

2. Doctype and standards compliance HTML/CSS - The structure of a web page is defined by markup language standards (HTML, XML and XHTML). The DOCTYPE descriptor tells the browser what document type definition to use in validating the structure and how strict to apply validation rules. The doctype tag is the first tag at the top of a HTML page. To ensure your page is cross-browser compatible it recommended to ALWAYS USE STRICT DOCTYPE and code your web page accordingly. This is fairly easy with new pages, but could be a nightmare for pages that have been developed over a long time, which might need to be re-coded or migrated. For more information about doctype's visit w3schools.

3. Avoid resizing images using CSS or HTML Code - we've all done it. An image doesn't fit the way it should, and instead of resizing the image in an image editor, we use the quick and dirty method, setting the width and height in code. Avoid doing so, IE is especially bad at resizing images in code, usually making the image look jagged edged or squashed. If you have to resize using code for whatever reason, try using the -ms-interpolation-mode: bicubic; CSS switch. It supposedly reduces the jaggedness.

4. Use a CSS reset at the start of your CSS - If you site relies heavily on CSS then it is highly recommended to reset/zero value your CSS. Yahoo developer tools have a helpful CSS reset file that you can use as well as some other helpful information. basically the reset file doesn't necessarily ensure browser compatibility, as much as it it ensures that your code renders the way it's supposed to, removing that extra line break or padding that you know you didn't include, but yet is displayed on your page.

5. Resize text as percentage - Size all your document text as a % within the body, and as em’s throughout the HTML page. This also is also good for accessibility as much as for browser cross compatibility. A good article on text sizing is available here.

6. Font rendering - Use -moz-opacity:0.99 on text elements to clean up rendering in Firefox, and text-shadow: #000 0 0 0 in Safari - Safari 3+ has an issue with the way it renders light type on a dark background. Some would argue whether this is good or bad, but there’s a way to make it appear lighter.
Easy fix.

You need to add this to your code.

p {text-shadow: #000 0 0 0;} 
Where #000 is your background color. You will probably have to be more specific with the elements you select.
It is not recommended to use this fix on the body tag.
Other elements you might need to fix are the li, dt, dd, blockquote etc. Use this on any text element you want to appear ‘thinner’

To make this fix in Firefox, you use the opacity fix:

p {-moz-opacity: 0.99;}

You need to be careful with this fix, as it will break any Flash element that it touches in Firefox. There appears to be no workaround for it.

7.  Font Selection - Try use common fonts that you know are available in most opiating systems - For example Lucida have been known to render pretty badly in Internet Explorer, while rendering pretty well in Safari. Rather just avoid it and stick to fonts that are common to all operating systems.

8. Avoid using transparent PNG images - Internet explorer 6 does not support alpha transparency in PNG images. There are a few work arounds, which you can simply Google, most of them have a few side affects. One that I have used before is Twinhelix.

9. All layout divs that are floated should include display:inline and overflow:hidden - When you have a standard layout, with floats sitting next to each other, with set widths, but an image or long string of text is longer than this width, the layout could break in Internet Explorer 6. If you place overflow:hidden; into the layout divs, the layout shouldn't break.

10. Containers or container div's should have overflow:auto or overflow:hidden and trigger hasLayout via a width or height - This is to avoid circumstances where a div container does not wrap around all the containing div's like its supposed to. You can always test it by using a background image on the container.  You’ll also need to make sure hasLayout is triggered in Internet Explorer 6. You can do this by specifying a width or height. If you don’t have a width in your div container, you can use height:1% to trigger it, or zoom:1; if you can’t afford to give it a height.

11. Avoid using the brand new CSS 3 selectors - many of the new CSS 3 selectors aren't supported by Internet Explorer 6.  For a full list of supported selectors, check out evotech.net’s post on browser css selector support.

12. Test, Test and Test - test your site for cross-browser compatibility using the actual browsers and virtual machines or by using software such Multi-Browser Viewer. I would always recommend you test in the actual browsers like Internet explorer, Google Chrome, Firefox and opera when you first launch your site and use a service like Multi-browser Viewer to continually test your site over time for any major problems.

I would like to thanks ADM blog and webappers, which I also used for reference for this blog entry.


Location: PostList


Getting Started and Basic usage

clock September 15, 2009 14:30 by author

Multi-browser Viewer is really easy and straight forward to use. If you can surf the web, then you should be able to use our product. It's really that simple.

How to cross browser test your site using standalone virtualized browsers:

1. What is a virtualized browser?
Test your website in 16 standalone virtual browsers that run instantly on any desktop. All browsers run as a single executable that runs instantly — no DLLs, data files, service installations, or runtime dependencies. The virtual browsers allows the application environment, including file system and registry subsystems, to be isolated from your computer, preventing the virtual browsers from interfering with one another or with any applications installed on your computer.

2. How to test using Standalone browsers?
Click on the tab on the far left "Standalone browsers". You will notice here are 16 browsers. Simply select the one you would like to launch and click on the corresponding icon. In the evaluation version, only six browsers are available, but the six browsers include IE6 and Safari 3.2, which are both very well known for causing cross browser compatibility problems. As far as we know, Multi-Browser Viewer is the only software available that allows you to run IE6, IE7 and IE8 alongside each other with no problems using their own rendering engines.

How to view your site in more than 45 browsers on 3 OS's:

1. Select Browsers
Select the browsers that you would like to test in the respective operating systems. There are more than 45 variations available. You can select browsers in 3 ways:

Option 1: Option 2: Option 3:
Select browsers1 Select browsers2 Select browsers3
1. Select browsers individually from the list on the right 2. Right click on the list, and select one of filter/selection options, including "Select All" and "Clear Selection". 3. Use the drop down filter options in the file menu at the top.

 

2. Enter URL
Enter the URL that you would like to test and click "Go". Any URL that you can navigate using your browser should work, except pages that are behind a login/password combination, which is not supported at present.

 

Enter URL

 

3. List of Requested Images
The requested list of images will be displayed in the table area in the top right of the page, along with their estimated load times and server status. The status will change as our network of machines attempt to load the URL that has been requested.

Selected Browser List and status

 


4. Preview/View Screenshots
Thumbnail images that have been downloaded will be displayed in the "Album view" window.

  • An image is opened in your machine's default image viewer either by double clicking a thumbnail image or by using the right click menu option.
  • As you mouse over a thumbnail image the type of browser is displayed in the top right of the "Album View".
  • Thumbnail images can be resized by using the "Resize Thumbnails" slider bar just above the Album view or alternatively by using the "Zoom" drop down in the lower right of the screen.
  • If an image hasn't loaded correctly then you can request that the image be re-delivered by clicking the "Request New Image" button in the top grid, or alternatively right click on the thumbnail image and select "Request New Image". The faulty/incorrect image will be deleted and a new image will be requested.
  • Another convenient right click function is the "Copy Image", which will copy the full size image for use in image applications like Paint Shop Pro or Adobe Photoshop.
  • Images, HTML Source code (Text file) and the Archive (MHT) file are all saved in a time stamped folder under my documents.

Album View

 

5. Open Folder / Browse

  • The "Browse" option can be used to load previously downloaded images, HTML and archive (MHT) files into Multi-Browser Viewer. Once you have selected a previous session, that particular session's images will be loaded into the "Album view", HTML Source code will be loaded into the Source code viewer and the archived HTML(MHT file) will be loaded into the browser view.
  • The "Open Folder" option opens the currently selected, time stamped folder in Microsoft Windows.
Browse Option: Open Folder Option:
Browse Option Open Folder Option

 

6. HTML Source View

  • Multi-Browser viewer's HTML Source window displays the HTML source as it was downloaded for that particular time stamped session. If you loaded a previous session using the "Browse" button, then that particular session's HTML source code will be displayed.
  • The HTML source window does allow you to edit and make modifications to the HTML, however if you would like to save it, it is best to copy all the HTML (Ctrl-A and Ctrl-C for instance) and save it using your favorite HTML editor.

HTML Source Code View

 

7. HTML Validation

  • Internet Browser compatibility problems are often caused by improperly formed HTML. The Internet Browser then tries to "fix" the HTML and may render the page differently from another Internet Browser.
  • Multi-Browser Viewer has built in HTML validation that will check the HTML Source code line by line for any validation errors according to the W3C standards.
  • Any serious HTML errors will be displayed by highlighting the text in red and by a red dot that will be displayed in the left margin.
  • Multi-browser viewer will display HTML warnings by a yellow dot in the left margin and by highlighting the text in yellow.
  • Hover your mouse cursor over the highlighted text or left margin dot to see the html error or warning.

Multi-Browser Viewer HTML Validation Screenshot

 

8. HTML Auto-Correct feature and Options

  • Multi-Browser Viewer's "Clean HTML" option allows you to auto-correct most of the HTML warnings. You can then conveniently copy and paste your HTML code to your HTML editor or save it to a file to replace the HTML that is currently on your site.
  • Multi-Browser viewer will create a suggested "Clean" or "Correct" version of the HTML source code using the "Clean HTML Options".
  • You can launch the "Clean HTML Options" from the file menu or by clicking "Clean HTML Options" button. Options will then be saved as your new default "auto-correct" preferences.
  • Please note: Multi-Browser Viewer does not save any actual HTML changes your source code files on your machine or on your website, updates are made in the editor as suggestions only. You can then use these suggestions in your favorite HTML editor.

Multi-Browser viewer HTML Auto-Correct options

 

9. View in Browser Option

  • The "View page in browser" view, loads your saved browser archive file (MHT file) into your local machine's default installed browser.
  • Using the "Browse" option you can load any previous Multi-Browser Viewer sessions into your "Browser view". You can also view the MHT files outside of Multi-Browser Viewer by opening the MHT files from within your browser.
  • MHTML or MHT, short for MIME HTML, is a web page archive format used to bind resources which are typically represented by external links (such as images, Flash animations, Java applets, audio files) together with HTML code into a single file. It is normally used for archival purposes.

Multi-Browser viewer - MHT, Browser Archive view

 

10. View as Folder

  • view as folder options just gives you a clean, convenient windows list view of you images.
  • All icon files, text and HTML files are filtered out and not displayed here.
  • This view is convenient to compare file sizes and to make sure all files have been downloaded by Multi-browser Viewer.

Multi-Browser Viewers Folder View

 

If you have any questions, problems or comments about Multi-Browser Viewer, please feel free to contact us at: support@multibrowserviewer.com or use the "Contact us" form in the application under the help menu. Alternatively you can contact support via our website www.multibrowserviewer.com.

 

 

 

Location: PostList


About Multi-Browser Viewer Blog

The Multi-Browser Viewer blog pages feature Cross-Browser compatibility tips, tricks and stats. As well as
Multi-Browser Viewer related FAQ's, Support documentation and release notes.

Please feel free co comment and ask questions.

RecentComments

Comment RSS

Sign in