What are the major differences one should keep in mind when trying to make a Web page/site compliant for both Internet Explorer 4+ and Netscape Communicator 4+?
Jayesh Nazre Following are some of the guide lines which you can use.
- Do not Use VBScript if you want to target both the browsers for client side validation.
- The DHTML supported by both browsers is not the same e.g. innerHTML is a property available only in IE. Layers are available only in NS.
- The event handling of IE/NS is also different
IE has what I call bubbling event model (bubbling because the events bubble from the bottom to the top).
NS has what I call drop down model (drop down because the events drop from top to bottom).
- The properties of the event object and how the events are captured are also different.
- Also certain features are available only in one browser. For example:
a) "disabled" attribute associated with input tag with type=text is available only in IE.
- Also, if you are planing to use XML please note that only IE supports it, NS6.0 says they support it but I haven't tried. All earlier versions of NS do not support XML.
- IE does not need a form tag to show any elements like say (a text field), NS needs a form tag. Without a form tag it will not show any elements.
Many people give different solutions for cross-browser issue. Broadly speaking they will fall in the foll. catagory:
- Do not use anything that is not supported by both the browsers (this is very tough to accept).
- Use two different function sets to handle cross brower issues.
- Use a single function set with a flag to identify which brower the script is running in. This you can easily find out by using the appVersion, appName properties of the navigator object.
- Another useful piece of advice, try to write code which works with NS browser, because if the code works in NS then almost 3/4 of your work is done, because coding in IE thanks to Microsoft is easier. Remember they are the ones who deviated from the W3C standards.