Home  >  Article  >  Web Front-end  >  IE6 BUGs and Fixes - Strategies to Prevent Problems Before They Happen_HTML/Xhtml_Web Page Production

IE6 BUGs and Fixes - Strategies to Prevent Problems Before They Happen_HTML/Xhtml_Web Page Production

PHP中文网
PHP中文网Original
2016-05-16 16:42:031299browse

Before discussing the BUGs of IE6 and how to fix them, it is necessary to talk about some strategies to avoid these annoying problems - as the saying goes, nip them in the bud.

Original text: Ultimate IE6 Cheatsheet: How To Fix 25 Internet Explorer 6 Bugs
Translation: http://www.php.cn/(Translation pair The original text has been supplemented)

Before discussing the BUG of IE6 and how to fix it, it is necessary to talk about some strategies to avoid these annoying problems - as the so-called prevention Suffer before it happens.

IE6 market share

According to Market Share statistics, the current (August 2009) market share of IE6 is 25.25%, but The statistics in other places are obviously lower, 18.1%; although the statistical results are different, they all show a downward trend (when this article was translated, Taobao’s IE6 users had dropped from 70% to below 70%. to 69%). But the most important thing is the statistics of your own website. If you conduct traffic analysis on your website, is IE6's share worth developing for IE6? This needs to be weighed by yourself.

If the vast majority of visitors to your website do not use IE6 and do not pay you, then you do not need to specifically make it compatible with IE6, thereby saving time, energy and money.

Make a concise design

Consider the implementation of the code while designing to avoid some layout problems. No matter how complex the design draft is, it can be implemented with concise code. If you use too complicated tags, then you need to revise the design draft.
If you have rich development experience and have overcome many layout problems, record your solutions to improve development efficiency when encountering the same problems in the future.

Use appropriate document declaration (doctype)

Using a wrong document declaration will trigger quirks mode (weird mode). A correct document declaration can ensure that your page Maintains consistent performance across all browsers. Use one of the document declarations: HTML 5[/i], [i]HTML 4.01 Strict[/i], [i]HTML 4.01 Frameset[/i], [i]HTML 4.01 Transitional[/i], [i] XHTML 1.0 Strict[/i], [i]XHTML 1.0 Frameset[/i], [i]XHTML 1.0 Transitional[/i], or [i]XHTML 1.1

HTML 5 HTML 4.01 Strict //W3C//DTD HTML 4.01//EN" "

http://www.php.cn/

">

HTML 4.01 Frameset

http://www.php.cn/">

HTML 4.01 Transitional

http://www.php.cn/">

XHTML 1.0 Strict

http://www.php.cn/">

XHTML 1.0 Frameset

http://www.php.cn/">

XHTML 1.0 Transitional

http://www.php.cn/">

XHTML 1.1

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.php.cn/">

Verify your code

I have heard some people think that verifying code has no practical value, but I don’t think so. Validation only takes a moment and will benefit all browsers, not just IE6; validation ensures backwards compatibility and is easy to maintain. At least XHTML must be validated! The only time you can ignore validation is if you plan to use CSS3. You can use the tools provided by w3Verify XHTML

/

Verify CSS

Be compatible with standard browsers first

In the process of writing code, first test in standard browsers (such as Firefox, Opera, Chrome, etc.), and then test non-standard browsers (such as IE6/IE7), because these standard browsers all follow w3c Standard, most treatments are the same. You can separate them to be compatible with "special" IE browsers. This will standardize your code and you will have a solid foundation; and if you no longer need to be compatible with these non-standard browsers, you can delete them all at once. These fix compatibility code.
Progressive Enhancement

Progressive Enhancement is to ensure that basic functions are available even without page special effects. Simply put, progressive enhancement refers to adding various special effects (JavaScript animation, Ajax asynchronous, etc.) to the page after ensuring that the page can operate normally after JavaScript is disabled. We can also use the "progressive enhancement" principle to use CSS3 (or some CSS2), HTML5, and other web specifications that IE6 does not support.
In some cases, it is impossible to make all users exactly the same in any browser, especially those using IE6. Using a progressive enhancement strategy ensures that those users are using at least the basic functionality of your website (or web application).

More information on progressive enhancement:

  • Understanding Progressive Enhancement (Translation)

  • Understanding Progressive Enhancement

  • Progressive Enhancement With CSS

  • Progressive Enhancement: What It Is, And How To Use It?

  • Graceful Degradation vs. Progressive Enhancement

  • Pragmatic Progressive Enhancement - Why You Should Bother With It

Use your own default style (CSS Reset)

Each browser has its own different default styles. Using the default style (CSS Reset) before your style sheet can avoid writing lengthy browser-compatible styles later. There are many CSS Resets available for reference on the Internet.

Simple CSS Reset example:

body,p,ul,ol,li,h1,h2,h3,h4,h5,h6,form,fieldset,input,textarea, p,
th,td {margin:0;padding:0;}

Some CSS Resets for reference:

  • YUI CSS Reset

  • Eric Meyer's Reset Reloaded

  • KISSY CSS Reset

Use JavaScript framework

If your website uses a lot of JavaScript effects, it is recommended to use JavaScript framework. Most js frameworks are compatible with various browsers including IE6. There are many optional frameworks, but generally the effects that can be achieved with one framework can definitely be achieved with another framework, so you can choose the appropriate framework according to your personal preferences.

The following are some commonly used JavaScript frameworks:

  • MooTools

  • jQuery

  • ProtoType with Scriptaculous

  • Dojo

  • Ext JS

MooTools is highly recommended, but if you are a beginner, it is still recommended to use jQuery.

Use JavaScript to emulate a standard browser

There is now some JavaScript to make IE emulate a standard browser, if you have a high percentage of users using IE6 and have JavaScript turned on , you can consider using Dean Edwards's IE7 or similar scripts.
Translator's Note: It is not recommended to use these scripts, because the implementation of these "simulations" often consumes a lot of resources, and IE is already bad enough.

How to debug the page under IE

Debugging the page under IE is very troublesome, the extension under FirefoxFirebug and Web Developer Toolbar are all very useful tools. If you want to use firebug on IE or other browsers, you can use Firebug Lite.
There are two best debugging methods under IE: IE Collection and IETester, and both are free (although they have a few flaws). The developer of IETester also provides DebugBar. This IE plug-in is free for personal use, but commercial users can only try it for 60 days.

The above is the content of the IE6 BUG and repair strategy called prevention strategy_HTML/Xhtml_webpage production. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn