I Can Be Viewed In Internet Explorer & Firefox

 

I took a look at my own home page on Firefox, and it was nasty looking! I wrote my home page for IE using CSS. I split up the page into two sides, using <div> tags to separate the two sides. The left side looks just fine in both IE and Firefox, but the right side got all jumbled up. I thought about the <!-- if [IE] --> tag for the code I already had. <!-- if [IE] --> is only seen by IE, so my IE code doesn't show up in Firefox. ...but Firefox doesn't have a conditional tag, so how do you display Firefox markup code in Firefox only?  JavaScript to the rescue!

Web pages are created to a specification called DOM; Document Object Model. As the name suggests, web pages consist of objects, one of them is the navigator object. ...and of he navigator's properties is appName; strictly speaking, navigator.appName. The appName tells you what you would expect, the name of an app; Netscape in the case of Firefox (so now we know the origin of the code used in Firefox - Netscape Navigator).  Therefore we can delineate our code in two parts:

 

                   <!-- if [IE] -->                                                 <script language="JavaScript" type="text/JavaScript">

                    Internet Explorer code                                       if (navigator.appName == "Netscape")

                   <! [endif] -->                                                    {

                                                                                                document.writeln(Firefox code);

                                                                                                                    .

                                                                                                                    .

                                                                                                                    .

                                                                                            }

                                                                                         </ script> 

 

Obviously I was able to put my IE code "as is" in the IE section, but I had to experiment with the Firefox code to get it to display the same way (or close to it). Not too bad of an experience, but I did see a bunch of queries on the Internet on how to do what I just did, so I thought I should post this. All the replies to the queries I saw were by Firefox users, and they smugly answered that you don't have to do anything with Firefox code because it is already perfect! What a bunch of browser racists! I approached this as somebody who is writing for IE and had to re-write for Firefox; just what the posts were asking for.

...and if you're wondering why this is in my blog section, it just bugs be how these Firefox racists act like it's such a big deal that they have to modify their html code for IE, and then turn around and explain why IE developers should have to modify their code.

 

                                                                      

Return To Program List                      Back To My BLOG Page