Showing posts with label bugs_ie. Show all posts
Showing posts with label bugs_ie. Show all posts

ERR_CONTENT_DECODING_FAILED in Google Chrome

I've a problem with Google Chrome Navigator in my site www.tadarank.com and www.ofertamagica.com.br

Chrome don't show the page, but this error:

Error 330 (net::ERR_CONTENT_DECODING_FAILED)

Looking this problem on Google, i've found many solutions (including reinstall Chrome).

The solution that works for me was relationed with Zip compression on website.

I made some tests and solved my problem changing headers.

In PHP, i change the header:

header('Content-Encoding: gzip, deflate');

to

header('Content-Encoding: zlib, deflate, gzip');

No more psroblems with Google Chrome / ERR_CONTENT_DECODING_FAILED. I hope that this solution work to you too.

Sorry my poor "engrish".

New way to hover and first-child in IE6

Hi, i'm back

Now, i show a new way to simulate pseudo-class first-child and hover in IE6 with a diferent method. No HTC, no tag script, no external file.

The advantage of my new code is that can be inserted directly in CSS and not needs another file. The idea of "expression" can be used to other implementations :).

Micox Pseudo-class-css2 to IE (MXPC)

/* Micox Pseudo-class-css2 to IE (MXPC). Activate .hover and .first-child in IE 6 */
* html * { color: expression( (function(who){ if(!who.MXPC){
 who.MXPC = '1';
 if(who.nodeName != 'A'){
  who.onmouseenter=function(){ who.className += ' hover'};
  who.onmouseleave=function(){ who.className = who.className.replace(' hover','')}; }
 (who==who.parentNode.firstChild) ? who.className += ' first-child' : '' ;
} } )(this) , 'auto') }

/* example */
p:first-child , p.first-child { color: red }
li:hover a , li.hover a { background-color: blue }

How to use? Just put on top of your css code and use classes .hover and .first-child with the :hover and :first-child. See a online EXAMPLE page and code source.

p:hover , p.hover { color: red }

Comments please.

Activating option disabled in IE

In Internet Explorer, the attribute "disabled" fails if used in tag option. See here a javascript to simulate the "disabled" attribute in Internet Explorer.

This code will execute and disable option in Standard browsers (FF, Op, etc):

<select>
   <option>opt 1</option>
   <option disabled="'disabled'">opt 2</option>
   <option>opt 3</option>
</select>

In IE, it will fail.

The above code, simulates the attribute "disabled" to IE, using JavaScript. Try-it:

<!--[if lte IE 7]>
<script>
function ativaOptionsDisabled(){
    var sels = document.getElementsByTagName('select');
    for(var i=0; i < sels.length; i++){
        sels[i].onchange= function(){ //pra se mudar pro desabilitado
            if(this.options[this.selectedIndex].disabled){
                if(this.options.length<=1){
                    this.selectedIndex = -1;
                }else if(this.selectedIndex < this.options.length - 1){
                    this.selectedIndex++;
                }else{
                    this.selectedIndex--;
                }
            }
        }
        if(sels[i].options[sels[i].selectedIndex].disabled){
            //se o selecionado atual é desabilitado chamo o onchange
            sels[i].onchange();
        }    
        for(var j=0; j < sels[i].options.length; j++){ //colocando o estilo
            if(sels[i].options[j].disabled){
                sels[i].options[j].style.color = '#CCC';
            }
        }
    }
}
window.attachEvent("onload", ativaOptionsDisabled)
</script>
<![endif]-->

Update: See other good solutions in comment box above too!

Ok. Now its just call this function in document load

<body onload='ativaOptionsDisabled()'>