Gavin Stevens's Blog

the ramblings of another developer....

  Home  |   Contact  |   Syndication    |   Login
  32 Posts | 0 Stories | 43 Comments | 215 Trackbacks

News

Archives

I can’t believe I am writing this, or that I am having to code this way.  It seems a major client of ours refuses to use IE.  So out major webapp has to be compliant with Netscape and Mozilla Firefox.  Man does that make for problems.  Although the DOM should be the same, it seems MS has of course, added a bunch of custom stuff that works in IE.  Yeah .NET is supposed to determine the browser type and output the proper html.  This does work, but it’s not the case when it comes to using javascript!  It seems IE and Netscape view the DOM differently when it comes to executing javascript code on the client.  for example:  I had this simple javascript to do a calculation on the client page:

  function DoPercentCalc()
 {
  var ValueControl;
  var DivisorControl;
  var DestinationControl;
  ValueControl = document.getElementById('txtboxHomeless');
  DivisorControl = document.getElementById('lblTotalUnits');
  DestinationControl = document.getElementById('lblpercent');
  DestinationControl.innerText = (setDecimalString(2,(parseFloat(ValueControl.value) / parseFloat(DivisorControl.innerText)*100)))+ ' %';
 }
while this works fine in IE, it doesn't work in Firefox....  I had to change the script to use DestinationControl.innerHTML, instead of innerText.  This is fine as IE sees this property also, but it crashes miserably if any tags are used in the html, ie, bold, italics, whatever, anything but a number and I'm screwed. 

Why are we here again?  I hate javascript!  I have no choice but to make the app work in Firefox, but at least I can vent about it!

Gavin

posted on Monday, August 30, 2004 5:01 PM

Feedback

# re: Return of the Browser wars... 9/2/2004 3:04 PM Hank Parnell
>>I hate javascript!

Thanks you! Finally someone else has said. Although I am sure you or I are not the first or last ;-)

So what is this jackass company you are working for anyway? Do they not understand the benefits they can get by getting off of their Netscape high horse? If people would stop being Martyrs for this sort of thing, we would all be better off and the "war" would end.

# re: Return of the Browser wars... 10/13/2004 7:05 AM Santosh
>>>>
Thats fine using ie, but it adds some values to use fierfox its really good , but I had also faced many problems bcz of this browser war , many codes works fine on ie but not on mozilla ...
Try to stuck to the W3C recomandations and avoid any ie dependant stuff ....

# re: Return of the Browser wars... 10/22/2004 3:20 PM web dev
first, this page helped me fix pretty much the same problem.. thanks.

second, it has nothing to do with martyrdom..

IE is fine to use, but so is firefox and so is netscape.

can you imagine what would have happened if a company released a DVD player that certain discs would ONLY work on their player.. oh wait, they already did and failed.

the problem here is that people should be able to use WHATEVER browser they want and not have to worry about pages not working. it's not like you have to code it one way for ms and one way for firefox/netscape.. we just have to change our coding to using official DOM methods and properties and it will work on both. it's because MS worked for so mny years to create a proprietary system to lock everyone else out.

so just code to DOM and it will always work. code to IE and suffer the consequences.

# re: Return of the Browser wars... 4/2/2005 11:07 AM Vladimir
yeah... my daily link to visit is

http://www.google.com/search?q=I+hate+JavaScript

just to make sure: I'm not alone...

# re: Return of the Browser wars... 5/27/2005 10:20 AM Dark Destroyer
With thanks to Google, this solved my problem also, cheers!!!

I have to say though it is annoying when I work in a company where all but one browser is IE6 (which happens to be my bosses!!!) but i have to design stuff for ALL browsers. Yes it is good practice but when you are on an impossible deadline it ain't funny!!!

# re: Return of the Browser wars... 7/18/2005 6:43 AM Chris
Hi Thanks too this helped me.

But the mozilla high horse is the only way to ride if you care at all about the future. if you are M$ cronies then not much can be said to change your ways, but the rest of us hold out for the day when M$ doesn't want to control everything you do.

And what of unix users and Mac users and other users forgetting the other 20% of the population only makes you the loser.

Bring on the Browser wars I say.

P.S. I almost exclusivally use FireFox I only go back to IE when I want to check compatibilty. Why? I got sick of worrying about the latest virus to hit M$ land. FF aint perfect but as a starting place its already lightyears ahead.

# re: Return of the Browser wars... 1/14/2006 12:31 PM Ollie
Hi Brown-nosers,
Has nobody considered that if Microsoft actually stuck to the agreed HTML standards instead of trying to take over the world then things would be a bit simpler?
I thank God that Firefox exists. At least that gives people the choice between a well-written standard piece of software and a M$ piece of junk stuffed full of security holes.
Nuff said.

# re: Return of the Browser wars... 1/17/2006 6:54 PM JF
I think the problem is that MS seem to add functionality that devs require and use, and they do it a lot quicker than W3C. This is why people hit these obstacles. Always has been easier to develop for MS platforms because they listen to the requirements of developers and implement them and screw standards. Fact of life but is it a bad thing? They have bought plenty of useful functionality to the mainstream.

# re: Return of the Browser wars... 1/18/2006 10:42 PM anonymous coward
JavaScript is just your perception of the problem. Without realizing, you're blaming Firefox for not supporting a property which is invented by Microsoft and it's not an agreed standard ("innerTEXT").

If you had some (weak, even) knowledge of DOM and JavaScript you could implement this property for any browser in only a few lines of code.

But, you hate JavaScript--which is why your salary will drop to 30% in the next year (not quite kidding, unfortunately).

# re: Return of the Browser wars... 1/25/2006 12:41 PM PDXDude
This should do it

document.getElementById('element').textContent = "my text";

# re: Return of the Browser wars... 3/15/2006 6:34 PM littleM
Is document.getElementById('element').textContent = "my text"; DOM3 or Gecko or Rhino or Safari or what? This seems like basic functionality, after all, that's what the 'T' is in HTML. However, it seems that changing a text string on a web page is as straightforward as cleaning the WinXP registry. Is there one method that works everywhere the same way?

# re: Return of the Browser wars... 6/10/2006 12:28 AM Ben
I hate this whole compatibility crap. I wish innerHTML was bugless, that would fix everything

# re: Return of the Browser wars... 6/22/2006 1:15 PM Bill
Actually MS does pretty good at supporting W3C standards - W3C in turn doesn't do too well at supporting MS standards. They are, after all, the biggest player; it ist only natural they set some standards of their own. And all this "M$ is so evil, everything they propose must be fought against" -nonsense is what is causing most of the trouble to the exact same people that start these arguments. See reality people. MS rules, and is here to stay. DEAL WITH IT.

# re: Return of the Browser wars... 8/30/2006 1:49 PM Marc
IE supports innerText. FF supports textContent. Opera supports both. Make your own conclusion.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: