Justtechjobs.com Find a programming school near you






Online Campus Both


php-windows | 2003112

Re: [PHP-WIN] Redirection From: Stuart (lists <email protected>)
Date: 11/27/03

PETCOL wrote:
> <header>
> <script language="javascript1.2">
> function browserRedirect()
> {
> var ns4 = document.layers;
> var ns6 = document.getElementById && !document.all;
> var ie4 = document.all;
>
> if(ns4) URLStr = "http://www.php.net";
> else if(ns6) URLStr = "http://www.php.net";
> else if(ie4) URLStr = "http://www.php.net";
> else URLStr = "http://www.php.net";
> location = URLStr;
> }
> </script>
>
> </header>
>
> In the
>
> <body>
> echo "<script language='javascript'>\n";
> echo "browserRedirect()\n";
> echo "</script>\n";
> exit();
> </body>
>
> You might have a better cleaner suggestion?

If you're going to go this way (which as Rasmus pointed out is generally
very bad UI design) you might find the following a lot cleaner...

<script language="javascript">
     location.href = 'http://www.php.net/';
</script>

There is no reason to do any browser detection, especially if you don't
actually change anything based on what browser it thinks it is. The best
solution however would be to reorganise the script so it decides whether
to redirect before it outputs anything to the browser.

-- 
Stuart

-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php