internet explorer snippets

How to fix Internet Explorer and Firefox form encoding issues when posting data to a server having a different encoding

Tagged utf-8, iso-8859-1, internet explorer, firefox, encoding, form  Languages html

This snippet explains how to fix Internet Explorer and Firefox form encoding issues when posting data to a server having a different encoding than the source system.

This happens, for example, when you host a form on a server using ISO-8859-1 that posts data to a server using UTF-8.

The fix for Firefox (and Opera and other sensible browsers) is to use the accept-charset attribute:

<form ...  accept-charset="utf-8">

The fix for Internet Explorer is to use a hack:

<form ...  accept-charset="utf-8">
  <input type="hidden" name="enc" value="&#153;">
</form>

The hidden input field will make Internet Explorer understand that you want it to support UTF-8.

How to parse XML feeds with jQuery

Tagged atom, rss, feed, parse, jquery, internet explorer  Languages javascript
$.ajax({
    type: 'GET',
    url: '/some/good/stuff.xml',
    dataType: 'xml',
    error: function(xhr) {
        alert('Failed to parse feed');
    },
    success: function(xml) {
        var channel = $('channel', xml).eq(0);
        var items = [];
        $('item', xml).each( function() {
            var item = {};
            item.title = $(this).find('title').eq(0).text();
            item.link = $(this).find('link').eq(0).text();
            item.description = $(this).find('description').eq(0).text();
            item.updated = $(this).find('pubDate').eq(0).text();
            item.id = $(this).find('guid').eq(0).text();
            items.push(item);
        });
        console.dir(items);
    }
});

Your friend Internet Explorer

For IE 6 and better (worse?) the feed must return the right content type, so make sure the response contains this header:

Content-type: text/xml

If this header is not set the jQuery Ajax error handler is called and the feed is not parsed.

How to fix 80% of IE browser issues

Tagged bug, html, ie, internet explorer, compatibility  Languages 

Tell IE to use standards mode, not quirks mode

Define your doctype in your HTML:

<!DOCTYPE> element

See: https://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx

Tell IE to not use compatibility mode

This prevents, for example, IE 11 from using IE 7 rendering mode which can happen for many reasons.

If you can’t add an HTTP header, then add this to your HTML and pray that it helps:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

IE is using a compatibility mode if you see “compatible; MSIE” in the user agent header:

"Mozilla/4.0 (compatible; MSIE 7.0;"

See:

Validate your HTML and CSS

https://validator.w3.org/

Use an IE hack

Try “zoom” or “!important”.