Re: Redirection
| From: | Stuart | Date: | Thu, 27 Nov 2003 10:07:55 +0000 |
| Subject: | Re: Redirection | ||
| References: | 1 2 3 4 5 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-22222@lists.php.net to get a copy of this message | ||
PETCOL wrote:
<header> <script language="javascript1.2"> function browserRedirect() {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">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?
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