Pioneer Skin
Login  ::  Register
Monday, February 06, 2012
 
- - - - - - - - Sponsorship Advertisement Area - - - - Thank you to our Sponsors - - - - - - - - -
Net Magik Pros - Battle Creek, Michigan Web Designers

We are please to introduce the new and improved discussion forum. It should eliminate the issues we've been having with the discusson board in the past. The old forum will still be available in "read only" mode HERE in case anyone wants to review the old topics that were posted.

WGD Forum: Discussion
Subject: Auto Redirect based on browser format
Prev Next
You are not authorized to post a reply.

Author Messages
JosephUser is Offline
Newbie
Newbie
Posts:13


03/11/2009 9:51 AM  

Hi!  

    I've designed a website that works wonderfully in Firefox, Safari and Opera: www.apostlebailey.com.

    I still, however,  am looking for a way to make the layout work in Internet Explorer (at least version 6+).  Marc Coppins of NetMagikPros.com gave me some advice that I'm still working with - but if I can't get that to work, I want to try another solution:

   I'd like to build a version of the page that DOES work on Internet Explorer (IE), which I can easily do just working from a system that supports that browser, and have the main page (1) auto-detect incoming visitors using IE, (2) redirect those visitors to the "does-work-in-IE" (DWiIE) page, and (3) have the "does-work-in-IE" page redirect non-IE users back to the main site.

     In addition to the DWiIE page, I also want to create a dial-up (& maybe lower resolution) version of the page that will load more quickly (and perhaps fit on a smaller viewport/screensize).  Can or should that be auto-redirected as well?

    My main question is about auto-redirecting on the basis of browser used though.  

     Please let me know if you have any thoughts!
         -Joe Kawano 

tgoodsonUser is Offline
Newbie
Newbie
Posts:32


06/02/2009 11:57 AM  
Joe, here is some PHP code that I use to detect browser versions.
function detectbrowser()
{global $ver, $browser;
$ver = "unknown";
$browser = "unknown";
$ua = $_SERVER['HTTP_USER_AGENT']
if (($res = stripos($ua, "MSIE"))!== false)
{
$bs = substr($ua, $res);
$res = strpos($bs, ";");
if ($res !== false)
{
$ver = substr($bs, 4, $res-4);
}
$browser = "Internet Explorer";
}
if (($res = stripos($ua, "FireFox"))!==false)
{
$bs = substr($ua, $res);
$res = strpos($bs, "/");
$ver = substr($bs, $res+1, 8);
$browser = "FireFox";
}
if (($res = stripos($ua, "Opera"))!==false)
{
$browser = "Opera";
$ver = substr($ua, $res+1, 5);
}
if (($res = stripos($ua, "Netscape"))!==false)
{
$browser = "NetScape";
$bs = substr($ua, $res);
}
if (($res = stripos($ua, "Safari"))!==false)
{
$browser = "Safari";
$res = strrpos($ua, "/", $res);
$ver = substr($ua, $res+1, 3);
}
}

detectbrowser()
if ($browser == "Internet Explorer";)
{
include("iepage.htm");
}
else
{
include("standard.htm");
}

? >

Of course, I normally have the function definition in an include file, but the above will work just fine if your iepage.htm and standard.htm are complete pages.

Then again, see this months flexible web design segment (at the meeting) and I think that you'll see that there really isn't a reason to need separate versions.
** Tom **
www.omega-link.com
You are not authorized to post a reply.
Forums > Web Design > General Web Design Discussion > Auto Redirect based on browser format



ActiveForums 3.7
Home | Membership | Events | Forum | MyPage | Login
Copyright 2007-2008 by WGD Forum :: Designed by ZapWebDesign.com