Search code examples
phpjavascripthtmlhttp-redirectvisited

setting a url as visited


I have a

<a href="my_redirect_page.php?link=mylink">my_text</a> 

link on my page, and the following line in my_redirect_page.php:

header("Location: ".$mylink); 

but after the redirection, if I click on back in my browser, the "my_text" for the link does not appear as visited (in purple, instead of blue). How do I work around this? Is there a way to change the visited property in php or javascript?

Thanks,

Dave


Solution

  • Not a terrific solution, but, in my_redirect_page.php:

    <html>
    <head>
    <title>Redirecting...</title>
    <meta http-equiv="refresh" content="0; url=<?php echo $_GET['link']; ?>">
    </head>
    <body>
    Redirecting to <?php echo html_entities( $_GET['link'] ); ?>.<br>
    If you are not redirected, <a href="<?php echo $_GET['link']; ?>">click here</a>.
    </body>
    </html>
    

    Or something like that - the Page should load (thereby entering into the browser history) and then, with a delay of 0, load the targeted URL. Should, for some reason, the redirect fail, the user will see a page containing a link to the targeted URL.