Back Home

Open Designs

Community. Driven.

    • CommentAuthorniemion
    • CommentTimeMay 3rd 2008
     
    Is it possible to create a site on which a click on F5 will not just refresh the page but take you to another URL? Or just change the style sheet of the current page?
    • CommentAuthorcthelight
    • CommentTimeMay 3rd 2008
     
    No, but like a+r or somthing, ill try somthing with F5
    • CommentAuthorsummitr
    • CommentTimeMay 3rd 2008
     
    I imagine you could use cookies to implement something like that. Or, maybe use some PHP or something to randomly load one of many style sheets every time the page is loaded.

    Here is an example of the second method.

    Not exactly sure if that is what you want though.
    • CommentAuthorcthelight
    • CommentTimeMay 3rd 2008
     
    http://forum.mootools.net/viewtopic.php?id=9740
    • CommentAuthorniemion
    • CommentTimeMay 3rd 2008 edited by gnome on the 05th May 2008 at 16:37:08 EDT
     
    Posted By: summitrHere is an example of the second method.
    Thanks, now I now how to change the style sheet by refreshing.

    Still I would like to know if it is also possible to do a redirect?

    Posted By: summitrmaybe use some PHP
    That was what I was thinking about. Writing in the code that the second time the page loads it should do a redirect. Is that possible?
    Gnome turned on HTML
    •  
      CommentAuthorbakercad
    • CommentTimeMay 3rd 2008
     
    if you use PHP, you could probably use sessions to determine when to redirect. On loading the page the first time the session will not be set. Set the session, then when reloading check for the session, if it's set, redirect.
  1.  
    You might be able to us an invisible flash movie. You can assign keystrokes in flash, I've never assigned a F_ button but I think it would work.
    • CommentAuthorcthelight
    • CommentTimeMay 3rd 2008
     
    do a javascript redirect:

    location.replace = 'URL';
    • CommentAuthorkalyan
    • CommentTimeMay 4th 2008 edited by kalyan on the 04th May 2008 at 00:26:12 EDT
     
    @niemion: here is how to redirect it (php) after certain refreshes...
    If the user navigates away, the counter is reset, so when they come back later they can refresh once more to go away...
    <?php
    $refreshLimit = 2; // how many times can they refresh
    $redirectPage = "redirectedUrl.php"; // where to go

    $Location = $_SERVER['REQUEST_URI'];
    if( $_SESSION[ 'redirCount' ][ $Location ] >= $refreshLimit and $_SESSION['prevPage'] == $Location ) {
    $_SESSION[ 'redirCount' ][ $Location ] = 0;
    $_SESSION[ 'prevPage' ] = $Location;
    header( "location:$redirectPage" );
    }
    $_SESSION[ 'redirCount' ][ $Location ]++ ;
    ?>
    • CommentAuthorniemion
    • CommentTimeMay 4th 2008
     
    Nice kalyan, I'll try that later.