Jump to content
Fórum Script Brasil
  • 0

Script não funciona em Mac


Jacksonrs

Question

Mestres dos JavasScripts alguém saberia me dizer porque esse script não funciona em mac e qual seria a saida para ele redirecionar pra resolução certa ???

<script language="JavaScript">

function resolucao_img_sk(){

if (screen.width == "800" && screen.height == "600"){

window.location.href="index.php";

}

if (screen.width > "1920" || screen.height > "1080"){

window.location.href="index1280.php";

}

}

resolucao_img_sk();

</script>

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

De acordo com o w3schools, o screen.width deveria funcionar normalmente no Opera.

Mude sua função para o código abaixo e veja o que aparece no alert. Provavelmente o screen.width do opera retorna algo diferente.

function resolucao_img_sk(){

    alert('screen.width = '+screen.width+'\n'+'screen.height = '+screen.height);

    if (screen.width == "800" && screen.height == "600") {
        window.location.href="index.php";
    }

    if (screen.width > "1920" || screen.height > "1080") {
        window.location.href="index1280.php";
    }
}

resolucao_img_sk();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...