Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var x = screen.availWidth;
- var y = screen.availHeight;
- alert("LARGURA: "+ x +"nALTURA: " + y)
- </script>
- $(function() {
- $.post('alerta.php', { width: screen.width, height:screen.height }, function(json) {
- if(json.outcome == 'success') {
- // do something with the knowledge possibly?
- } else {
- alert('Impossível deixar o PHP saber a resolução da tela!');
- }
- },'json');
- });
- <?php
- // Você pode fazer algo parecido com isto:
- if(isset($_POST['width']) && isset($_POST['height'])) {
- $_SESSION['screen_width'] = $_POST['width'];
- $_SESSION['screen_height'] = $_POST['height'];
- echo json_encode(array('outcome'=>'success'));
- } else {
- echo json_encode(array('outcome'=>'error','error'=>"Não é possível definir a resolução."));
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement