homepage Welcome to WebmasterWorld Guest from 54.204.90.135
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Modern Browsers Actively Patch Broken Website Code
tedster




msg:3887680
 5:11 am on Apr 8, 2009 (gmt 0)

Browser vendors today go to extreme lengths to make sure they display websites well, despite errors in code. In fact, they actively patch bad code in some cases. The Opera team calls it "site patching".

In a new article by the Opera Core Developers, we get a look into this under-appreciated feature of the modern browser. As the above article says, "Often a broken site is not our fault, but it's most definitely our problem. And we must make it work today. Not in 2022."

Here are some examples they cite of browser site patching:

  • IE8 uses a 2400 site compatibility list that it displays in IE7-mode
  • Google Chrome spoofs the user agent on Hotmail
  • Safari has undocumented site-specific hacks (according to the article)
  • Firefox users have has the User Agent switcher add-on
  • Opera has user agent spoofing and browser.js

    Sometimes Opera's site patching gets even more detailed:

    We can add the single missing class name when AOL Japan abuses browser detection and doesn't apply correct styles, and correct AOL webmail's spelling mistake when they spell dojoType as dojotype.

    We can fall back to a graceful postMessage() call when E*Trade tries to violate the security policy against navigating another site's frame when it loads encrypted content

    It's one heck of an article, and certainly gives me a deeper appreciation for what it takes for any vendor to put out a world-class browser.

    An illuminating read: [my.opera.com...]

  •  

    JAB Creations




    msg:3887718
     5:59 am on Apr 8, 2009 (gmt 0)

    The problem isn't (most) rendering engines, it's the people who code to them.

    The first massive mistake everyone makes is coding to IE and then wondering why their sites won't work in rendering engines that support standards like those from the year 2001 (you know, eight years ago) such as...

    XHTML: application/xhtml+xml: if it's broken it won't work and that's why I use it. Can't serve that media type to IE? IE doesn't support XHTML but it does support XML, use the application/xml media type instead and with a little tweaking if your page is broken it'll break in front of your eyes. It's good practice too especially if you work with databases or can't easily validate your XHTML code. Think it's a waste of time? A week ago someone blew an entire day wondering why Safari was rendering code differently and started posting server side code...why? If the page was served as XHTML or even XML it would have broken and given him an error message instead; it was a missing double quote.

    CSS: Using level 1 for layouts (and validating your CSS file as only CSS level 1) by using divisible elements with floats while using margins as padding (for second generation divisible elements) there is no layout that is impossible. CSS2's positioning allows you to move things around for SEO purposes.

    Frankly I would like to see a rendering engine that will only render a page if there are no errors and possibly warnings though many warnings are debatable.

    As far as browsers are concerned they need to stop trying to fix sites; it's completely unacceptable. I've have multi-column support on my blog since Gecko 1.8 (Firefox 1.5 for those who don't know their rendering engines). Speaking of which how many of our fellow web designers actually test engines instead of browsers? There is no need to test Firefox 1.8 and 2.0, they use Gecko 1.5! IE 5.0, 5.5, and 6.0 have virtually all the same bugs with some rare exceptions that most designers won't understand. Still waiting on useful CSS3 properties Opera! Still waiting for something new and useful in the DOM IE...since I think 5.0 save for the support of responseXML!

    Then there is outsourcing: no not that type, I mean web design being outsourced to web developers. That's what really irks me about the IE blog, why are they talking about web developers?! They do server side code, not client! If you're working on a client side code then you're doing web design just like working with images and Flash is graphic design. Most web designers have great skill at least graphically speaking though what percentage actually work with a back end CMS or databases in example? It takes a lot of skill to do both competently and I've never met or talked with anyone who rocks hard at both naturally, not that one can't learn. I digress, most companies are willing to ax off a web design position and outsource it to developers who usually don't have the mindset for client side. When you're busy developing your client's next database as a developer you shouldn't be carrying the weight of wondering why importNode isn't working in IE (8) (as it's not supported without (you guessed it) a hack!)

    I personally get a lot of criticism for my own design but that's not the point really. No amount of polish matters if your page won't load before visitors leave, if it's not going to be found in SERP's on search engines, and if you can't get the basic CSS1 working in Opera 10, Safari 4, Firefox 3.5, and IE 5.0...or even IE 4 and Opera 4...yeah CSS1 works almost flawlessly across all those browsers.

    Using document.write, innerHTML, iframes, text/html, and referring to elements as "tags" will not only hold back web designers it will hold back the industry. I frequent the HTML5 forums a lot and some of the requests I see like references to the long deprecated embed element surprise me to no end. IE 5.0+ and every other browser I've tested (and I'm talking over 40+ versions of each rendering engine) properly support alternative content inside an object element. If this is the type of input browser vendors and standards groups are going to be bombarded with what does that say about our industry?

    Any one who wants to truly improve their skills needs to create their layout (with only a short paragraph for content) in Opera 6...and you can get CSS1 layouts to work perfectly (until you get fancy with content) in IE4 and Opera 4. Once you get that far go full blown XHTML and never turn back. Of course if you're trying to make an extra buck and splash Google advertising all over your page then what's the point? Tons of extra code and excess work at the loss of pressing forward your own skill set? WAI AAA compliance and you can validate it with the Web Developer toolbar. JavaScript object detection, etc. Simply put: the more you know the more you can do.

    - John

    "It is those who have this imperative demand for the best in their natures, and who will accept nothing short of it, that hold the banners of progress, that set the standards, the ideals, for others." - Orison Swett Marden

    [edited by: JAB_Creations at 6:00 am (utc) on April 8, 2009]

    tangor




    msg:3887726
     6:07 am on Apr 8, 2009 (gmt 0)

    I can understand the browser creator wanting their product to "work" for the user, but site repairs by the browser merely means the web remains flawed. How can one fix it if they can't see it's broken? (yes, I know there are validators...and way too many who never use them)

    incrediBILL




    msg:3887751
     7:27 am on Apr 8, 2009 (gmt 0)

    The rendering engines should just kick out a page stating "INVALID HTML FORMATTING" if something totally heinous pops up like a missing </div> </table> etc. and let the web site owner fix the problem instead of coddling them.

    Sometimes the broken page is because SEO hackers have injected a bunch of links into the page in a bad place or something similar, and it should just break so people know.

    mattur




    msg:3887859
     10:46 am on Apr 8, 2009 (gmt 0)

    I would like to see a rendering engine that will only render a page if there are no errors

    rendering engines should just kick out a page stating "INVALID HTML FORMATTING"

    Why?

    maximillianos




    msg:3887869
     10:53 am on Apr 8, 2009 (gmt 0)

    This same theory gets applied by websites to user generated content. The point is, there will never be a perfect web if the sites are human designed.

    I would go as far as saying the majority of web content today is not in perfect form.

    Any browser that would take the approach of only showing 100% validated pages would not be useful to 99% percent of Internet users as it would always be showing error pages.

    tangor




    msg:3888561
     12:23 am on Apr 9, 2009 (gmt 0)

    Not so sure I'd go "majority" as regards static page sites. I do encounter way too many generated sites that are chock full of errors. That, of course, is a different aspect of the same problem. My only concern is if the browser folks keep doing this (and we use those browsers to check our pages) we'll never know when bad code is created. What I'd like to see is the browsers insert an option to view the page (developer's side) without all their on-site corrections. This way the creator of the page can SEE AT ONCE the errors...

    Then again, I'd like to have been old enough to have had a date with Angie Dickinson when she made that movie with John Wayne. Oh... the impossible wishes!

    JAB Creations




    msg:3888586
     12:48 am on Apr 9, 2009 (gmt 0)

    mattur, you didn't read my post.

    maximillianos, then those people either learn to do their job right or find a different industry to work in.

    It's about doing your job competently and this is what the thread and Opera post highlights.

    - John

    incrediBILL




    msg:3888588
     12:59 am on Apr 9, 2009 (gmt 0)

    maximillianos, then those people either learn to do their job right or find a different industry to work in.

    Bingo.

    How many programmers do you think would keep their jobs if every time you tried to use their software it simply crashed?

    Heck, RSS feeds that don't validate get kicked out of RSS feed readers, so why should web pages should be treated any different?

    It's either valid or it isn't.

    Don't forget, with everyone trying to get fancy and shove javascript into pages a lot of inept programmers are already making web pages go BOOM! so their bad HTML shouldn't surprise anyone either ;)

    swa66




    msg:3888614
     1:56 am on Apr 9, 2009 (gmt 0)

    If they'd at least give us an easy switch to turn off/on their "we'll fix the site" so we could see errors "in our face".

    rogerd




    msg:3888658
     3:37 am on Apr 9, 2009 (gmt 0)

    People want an easy way to surf the web. If a browser failed to render many sites as the designer intended, they would switch to a browser that didn't have those "problems." The fact that the problem is bad coding is irrelevant to the average user.

    tangor




    msg:3888672
     3:47 am on Apr 9, 2009 (gmt 0)

    The fact that the problem is bad coding is irrelevant to the average user.

    Hence the urgent need for a "View as Developer" option, ie. show us what we did wrong... Set as default OFF so only the brainiac webmasters will turn it on to see what the web REALLY LOOKS LIKE.

    Otherwise, where is the incentive to clean up code?

    incrediBILL




    msg:3888674
     3:52 am on Apr 9, 2009 (gmt 0)

    The fact that the problem is bad coding is irrelevant to the average user.

    Don't say that too loudly around the web accessible crowd, they might chew you up and spit you out.

    Besides, how hard is it to get a page to cleanly pass 4.01 transitional?

    If I can do it, anyone can...

    tangor




    msg:3888676
     3:56 am on Apr 9, 2009 (gmt 0)

    incrediBILL... you and I know that, but how many others do?

    explorador




    msg:3888707
     4:47 am on Apr 9, 2009 (gmt 0)

    That's awesome, let's hope Perl, PHP, ASP and every language known applies the same... </sarcasm>

    Not because I work on this field but: such practices should be avoided. They allow millions of bad designers to make their living with bad practices promoting hacks and hacks, not hard work, not clean work. And, they make standards hard to work with as you are not getting what the code really says.

    Could it be at some point a legal point? offering something that technically the engine doesn't really do? (render code as it is?).

    renzo008




    msg:3888767
     7:38 am on Apr 9, 2009 (gmt 0)

    Opera is missing the boat here!

    The list they give is totally irrelevant.

    In past days several people said that Opera was the best browser to standards. I'm using Opera only for compatibility purposes and yes, Opera is not working for my biggest site! :) (Javascript Queue issue's)

    When i look at the browser list hacks in the article i see that, IE (Microsoft) has 2400 site hacks..

    Google hacks Hotmail.. because again it is Microsoft.

    The Firefox user-agent switcher is for development purposes.. so irrelevant.

    Opera is totally crazy with browser.js

    I don't want to go flaming here but i'm a notepad website builder for about 10 years. I know IE is called as the horror browser by us website builders.. Everything else then IE must be better, i disagree:

    I'm a big Firefox fan, and in past days i was anti-IE but sometimes when i'm testing with IE it looks like im thinking this browser is not that weird. I can't explain but IE is doing a good job. One thing i know is that IE can be blazing fast. Switching between pages in a site don't flash the logo for example.

    Although mr. Firefox is doing better ;)

    We just have to apply W3C standards.. XHTML, CSS3, HTML5 and the browser developers just have to be faster with implementation.

    Implementing hacks for websites is just a browser killer. I think we end-up with 2 major browsers, FF and IE. I hope the war is over, Opera back to your roots ;) Nice music by wonderful womans.

    g1smd




    msg:3888818
     9:13 am on Apr 9, 2009 (gmt 0)

    After one of the sessions at a local recent BarCamp, I'm looking more at Front End Testing, and am especially interested in the stuff coming out of Yahoo that eventually will integrate such testing with the commit function of {CVS} and similar systems. Wide deployment of that system will see a lot of code cleanup happening.

    mattur




    msg:3888846
     10:21 am on Apr 9, 2009 (gmt 0)

    It's about doing your job competently...

    For *us*, yes. For normal people it's about easily publishing and accessing information. Low barriers to entry is a feature, not a bug.

    Implementing hacks for websites is just a browser killer.

    The original article suggests site patching works [my.opera.com]

    T_Miller




    msg:3889324
     8:19 pm on Apr 9, 2009 (gmt 0)

    Besides, how hard is it to get a page to cleanly pass 4.01 transitional?

    LOL. On the forum for my cart software, it's very common for 'webmasters' (of ecommerce sites at that!) to have NO clue about page validation, doc types, browser quirks mode rendering, etc. They design in IE on a huge geek-toy monitor and wonder why their sites looks like crap on other systems, browsers, etc. And their conversion rate sucks.

    After numerous post trying to help people clean up their code and validate, we get replies like this that make you shake you head (my emphasis added):
    Update: I removed the DOC type and charset lines, and the site is back to normal.

    Global Options:
     top home search open messages active posts  
     

    Home / Forums Index / Code, Content, and Presentation / HTML
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved