Search Tools Links Login

A solution to cross browser compatability (Almost) *REVISED*


Script written for IE doesn't display correctly in wetscape, or vice versa. Here is a possible solution to your scripting compatablity problems.

Original Author: HTML Dude

Code




A solution to cross browser compatability (Almost)



Many of us who in the past have taught ourselves to script using any of the markup languages, HTML, CSS, have always been caught out by the apparent and real problems of cross browser scripting compatability.



Script written for ie doesn't display correctly in wetscape, or vice versa.



Well here is a possible solution to all your scripting compatablity problems.



This is a follow up, to the follow up, to Sam's arcticle posted 4/13/2001 11:23:48 PM, by VBguy.


Browser Wars 2



Yes I did say its a "follow up, to a follow up".



I would just like to make a few statements about the possible reasons VBguys web pages might not display in wetscape the same way as they do in ie.



Also let me state that I absolutely detest wetscape for the following (and I think valid) reasons.


Reasons To Detest wetscape




  1. It is an ugly and most user unfreindly GUI. (my personal opinion)


  2. It's now owned by AOL (Always Off Line?) a disgusting corporate bloat, which preys on the ignorance of innocents (much more so than microcrap does). AOL now owns Warners, Winamp and many other companies and products and is competing with microcrap on equal terms. they too are merciless in their quest for global dommination, maybe even more so than microcrap. (Not that I am particularly fond of microcrap and the methods it in it's quest for global domination).


  3. Yes, I will agree that in it's latest incarnation, it complies more closely with the W3C recommendations than ie does. And maybe some of the previous versions, but wetscape too have added their own extensions to the WC3 recommendations and it is these wetscape additions which cause us web creators to pull our hair out more often than not.


  4. It will not open pages in "full screen" mode as does ie.


  5. Its HORRIBLE and tries to take over my machine (Just like ie does)


Reasons why your pages might not display correctly



Now having said all that, I am afraid the real reason why your web pages do not display correctly in wetscape is because you are merely following
microcraps methods of writing HTML (and CSS) and not conforming to the guidelines as laid down by the W3C.



Of course this is understandable, because most of us either:


  1. learned to script using one or the other flavour of ie.

  2. we used a wyswyg editor, conforming to either one or the other browsers scripting styles.



Frontpage and Dreamweaver are the usual rogue suspects here methinks.



But even then with a little effort and patience, even these pages can be adjusted to display similarly in most browser.



NOTE


Newer version of frontpage and dreamweaver might create
simple pages which are cross browser compatible, but when you start creating
more complex pages, there is a higher risk of non compatibility, no matter what
their creators might say.


Using DOCTYPE and DOM



The trick is to use the "DOCTYPE declaration" in all of your web documents. Using the DOCTYPE declaration, enables the browser to parse and compile your document correctly.


Example of a correctly declared XHTML document with an XML
declaration (XML declaration used to notify user agents that this document is
"iso-8859-1" encoded.



  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


Unfortunately if used incorrectly, or with non conforming and invalid scripts, your pages still will look c.r.a.p, and be displayed differently by both browsers, because like the "higher" programming languages, only valid code will be interpreted correctly as each page is parsed by a browser.



For more in depth information see the following link to an excellent article on the subject of the DOM (Document Object model). I think this is essential reading for ASP coders, since it gives you a very simplified description of the concepts and uses of the DOM.



Introduction to the DOM
of IE 5/ NS 6





Hurrah, A solution to cross browser compatability (Almost)



Which brings me to my main point, which is that, we are now somewhat closer to a solution which goes some way to addressing the issue of cross browser
compatibility, in that both microcrap and wetscape have agreed (in principle at least) to more closely conform to the W3C DOM guidelines and more especially the way their browsers will treat valid and invalid HTML, XHMTL and CSS, of any flavour (version).



Scripts conforming to valid XHMTL will be displayed almost similarly by both ie 6 and higher and wetscape 7 and higher.



See the link below to view what constitutes valid XHTML.



http://www.w3.org/TR/xhtml2/conformance.html



Also take a look at the rules of conformance (link below) for USER AGENTS. This will give you an idea of how the newer browsers (user agents) will parse valid and invalid DTD's.



XHTML Conformance



Also non XHTML documents will be parsed and displayed in the same way as each previous version of a given browser would have parsed and displayed it.



I can see that I have begun to drone on and get a little too technical maybe (for some), but I will give you a hint of how to create web pages which both conform to the W3C standards and display "almost" similarly in both ie and wetscape.


How to create cross browser compatability (again, almost)



Always use a "DOCTYPE declaration" in your web documents and most of all use "valid" markup script.



Validate all your HTML and CSS pages using the following link.



http://validator.w3.org/


Finals Words



My finals words go to microcrap and wetscape.



Write down all the many and varied ways you have added "to" the W3C recommendations, within your browsers, shout about it to all who will listen and display then on a website of your choosing, but available to all, also stating the following.




  1. Any extensions you have added and how they might be incompatable with any other browsers.

  2. Any tests you have conducted to discover any incompatabilities contained within your extensions.

  3. Solution as to how to address and resolve these incompatability issues.


wetscape Take Note



In ie 5 microcrap invented Conditional comments which enabled ie 5 or higher browsers to hide certain code from other browsers enabling us to add ie specific code to our pages. Why don't you folks stop being so proud and adopt this concept into wetscape and maybe we can all get closer to our dream (yeah sure) of cross browser compatablity some day (when the sun goes super nova, maybe)



Hope it helps ya'll



Let us give fanks to Rudd van Nistelroy and to alex fergeuson and to man utd fer beating arsenal.



P.S. You are welcome to email me (via PSC) if you require either further email or assistance.


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 141 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.