Hello, I built PHP function that recognize if the user OS is mobile or regular computer. if its mobile the script will redirect the user to the site mobile version. the problem is that the site first got loaded and than after it finish it redirect the user to the mobile version. How can I set it so my PHP function will load first? Thank you in advance, Roi.
Just add the following to the start of your script/site (within a global file - so it applies to all), and if its a mobile it would redirect to the mobile version, if its not it won't: <?php //detect_mobile() should be your function which should return true if mobile... if (detect_mobile()) { header("Location: /mobile"); } ?> PHP:
I'd assume it would be similar, but never worked with ASP so can't be certain. But let me know how the PHP code goes...