Jump to content
Fórum Script Brasil
  • 0

Verificar Resolução Da Tela


leonardocdc

Question

4 answers to this question

Recommended Posts

  • 0

pessoal, fiz um script para retornar a resolução de tela em php e vou postar para ajudar quem precisar:

- no mesmo arquivo .php faça os dois seguintes comandos abaixo, na ordem:

<script type="text/javascript">
var alturaTela = screen.Width;
var larguraTela = screen.Height;

if (alturaTela == 768) {
<?php define("scAlturaTela", 768); ?>
} else if (alturaTela == 720 ) {
<?php define("scAlturaTela", 720); ?>
} else {
<?php define("scAlturaTela", 640); ?>
};

if (larguraTela == 1366) {
<?php define("scLarguraTela", 1366); ?>
} else if (larguraTela == 1360 ) {
<?php define("scLarguraTela", 1360); ?>
} else if (larguraTela == 1280 ) {
<?php define("scLarguraTela", 1280); ?>
} else if (larguraTela == 1024 ) {
<?php define("scLarguraTela", 1024); ?>
} else {
<?php define("scLarguraTela", 860); ?>
};
</script>

<?php

function larguraTela() {
return scLarguraTela;
}

function alturaTela() {
return scAlturaTela;
}
?>

espero ter ajudado.

Abraço

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...