Jump to content

Recommended Posts

Posted

Hi.

 

I wanted to know if this could be done.

 

I want to put on some .wml pages on my site, but the thing is, I want those pages to go to an html page if it is accessed by a regular computer's internet browser.

 

Is it possible to do this?

 

If it isn't possible, is there anyway I can put some code in the .wml files that will only render in HTML browsers.

 

Right now as it is with my .xml files, when I point my browser to them, they are just downloaded as a file and I don't want that to happen.

 

All help will be appreciated.

 

Thanks.

Posted

You can do this with a PHP redirection script.

 

><?
$wmlredirect = "http://www.******/wml/index.php";// Your WAP Site
$htmlredirect = "http://www.******/html/index.php";// Your HTML Site

// Get browser ID
$browser=substr(trim($HTTP_USER_AGENT),0,4);

// Identify Web Browsers
if($browser=="Mozi") // Mozilla, Internet Explorer 6 & Opera 7

{
	$br = "HTML"; // Identify the above as Web Browsers
}
else 
{
	$br = "WML"; // Identify balance as Wap Devices/Emulators
}

if($br == "HTML") {
header("Location: ".$htmlredirect);
exit;
}
else 
{
header("Location: ".$wmlredirect);
exit;
}
?>

Posted

Or by using rewrite rules in the .htaccess file

 

>#browser redirects For PDA Based Browsers
RewriteCond %{HTTP_USER_AGENT} "Windows CE" [NC,OR] #Windows CE and Pocket PC
RewriteCond %{HTTP_USER_AGENT} "NetFront" [NC,OR] #PalmSource WebBrowser 2.0
RewriteCond %{HTTP_USER_AGENT} "Palm OS" [NC,OR] #Eudora Web Browser for Palm
RewriteCond %{HTTP_USER_AGENT} "Blazer" [NC,OR] #Handspring Blazer Browser
RewriteCond %{HTTP_USER_AGENT} "Elaine" [NC,OR] #RIM Devices
RewriteCond %{HTTP_USER_AGENT} "^WAP.*$" [NC,OR] #WAP Browsers
RewriteCond %{HTTP_USER_AGENT} "Plucker" [NC,OR] #Plucker Offline download client
RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC] #AvantGo Service
RewriteRule ^index\.html http://www.yourdomain.net/index.wml [L,R]

Posted

Hi Bruce.

 

I tried that bit of code and replaced the necessary url's but it is redirecting my html browser (Firefox) to the WAP site.

 

Is there anything else I can do?

 

Thanks.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...