Question

For some reason re elements on my homepage are shifting up the page by about 25px. The only browser this happens in is google chrome version 28.0.1500.72. Every other browser is fine.

Is there a way I can check if the user is on this version and change the styles for that version only?

The code is fine so I know it's just something wrong with that browser version, jquery is the only way I can think of that this can be resolved

Type of jQuery function:

var browser = // what ever browser ;

if(// Browser version is ...){
    $(".EXAMPLE").css('top', '25px');
}

Thanks in advance for any answers, this has been very irritating as it's literally only that version. even works in ie6 through to 10.

Was it helpful?

Solution

i would like to see this on fiddle, i think it could be something else, but this could help you:

if(navigator.appVersion.match(/Chrome\/28.0.1500.72/))

OTHER TIPS

You can try to use this javascript code (coming from here) :

function getBrowserName(){
    var N=navigator.appName, ua=navigator.userAgent, tem;
    var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
    M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
    return M[0];
}

function getBrowserVersion(){
    var N=navigator.appName, ua=navigator.userAgent, tem;
    var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
    M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
    return M[1];
}

if (getBrowserName() == 'Chrome' && getBrowserVersion() == '28.0.1500.72') {
    // your code here
}

Maybe you can use the $_SERVER['HTTP_USER_AGENT'] like this :

... some JS ...
<?php if (preg_match('/28.0.1500.72/', $_SERVER['HTTP_USER_AGENT']) == 1) { ?>
all your new css
like  $(".EXAMPLE").css('top', '25px');
<?php } ?>

By this way, these new css will appear in the source code only with that version of chrome.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top