#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    5
    Rep Power
    0

    Refresh the page once detect resolution changes


    Hi,

    I was wanna to have a script that can make a refresh to the page once it detect change in resolution.
    I mean script make detect for resolution every second, and once changed , it make refresh itself...

    Hope I could find a solution for that soon

    Thanks

    Shady
    Last edited by shady; October 10th, 2003 at 02:52 PM.
  2. #2
  3. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    1,614
    Rep Power
    17
    Try this ..
    Code:
    <script type="text/javascript"><!-- webmasta
    
    var br =(navigator.appName =='Netscape')? 0 : 1;
    var olRes =(br)? screen.availWidth : screen.width;
    
    function chekRes() {
    	var chRes =(br)? screen.availWidth : screen.width;
    		if (olRes != chRes) { location =location; }
    }
    //--></script>
    
    <body onload="setInterval('chekRes()', 1000);">
    Welcone to the forums
    webM

    for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
    substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    5
    Rep Power
    0
    Thanks for reply, but for bad luck it doesn't work...
    While I don't have experince in javascript, but I notice you made it for netscape browser.
    The second thing, that i notice check for width, but what hight.
    Wish we can make a new good script

    Thanks again
  6. #4
  7. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    1,614
    Rep Power
    17
    It wasnt made for NN browser, Its cross browser for both mozilla and IE engines.

    NN uses a different property to get the screes res so the code has to be forked.

    And checking for height is not necessary because if the width changes, the height must change and vice versa.

    Dunno what you really expect it to do but the script does exactly what you asked in your first post.. check for changes every sec and reload the page if screen res changes.
    webM

    for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
    substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    5
    Rep Power
    0
    Thanks, as I told you, I'm not exp. in that...
    Any why I should try again with it, did you tried it yourself?
    2 Confirm, the code will put in the HEAD, the other between body tags, rite?

    Thanks again
  10. #6
  11. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    1,614
    Rep Power
    17
    Yes to both.... and it works...

    Tell me exactly how you are testing it to see if it works or not.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    5
    Rep Power
    0

    RE:


    Plz check the main page www.ifcalex.com/xetronix
    the problem, when user change resolution, the text layout position don't make refresh to suit the new resolution..
    So the answer for this problem is refresh it once res. changed.
    Your script is on it
    But seem not workin

    Thnx
  14. #8
  15. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    1,614
    Rep Power
    17
    Your script is on it But seem not workin
    No wonder....., you have 2 onload events... you need to combine them into one like this
    Code:
     onLoad="MM_preloadImages('images/index1_09.gif'); setInterval('chekRes()', 1000);"
    webM

    for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
    substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    5
    Rep Power
    0
    You seem right in this, but issue remaining....
    I uploaded the correction page, check again plz
    Try to open in 1024 then keep the browser open and resize to 800*600, then check the text layer
  18. #10
  19. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    1,614
    Rep Power
    17
    Three things...

    1. You removed my name from the script in the last version..not a big deal, but then....

    2. Something else is influencing that behavior, refreshing alone on res change is not solving your problem and I really dont feel like going through a mass of code right now.. its friday ... ...

    3. Refer to number 1.
    webM

    for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
    substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};

IMN logo majestic logo threadwatch logo seochat tools logo