|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
WAP/WML headers and site not being displayed.
I am creating a WML/WAP website......the site is to work on PDA's & WAP phones. I am however running into a very serious issue with the header type. Some mobile devices require a text/html, others WML.....so I wrote a function that detects useragent - and it seems to be accurate.....however, on many mobile devices that have odd browsers, the user sees an error when trying to view the page.....on those I must send a text/html header to get it to display but then none of the form processing features on my site work - html doesn't recognize the WML form processing.....how do I get over this hurdle?
Here is how I check for browser useragent with PHP Code:
function browserCheck() {
//CHECK FOR BROWSER STATUS HERE
//$type = 1 - BROWSER IS IE/FIREFOX - TEXT/HTML HEADER SENT
//$type = 0 - WEB ENABLED PHONE - WAP HEADER SENT
$ua_info = @get_browser($_SERVER['HTTP_USER_AGENT']);
if($ua_info && ($ua_info->browser == 'IE' || $ua_info->browser == 'Firefox')) {
$type = 1;
}
else {
$type = 0;
}
return $type;
}
Here is how I differentiate the header that is sent: Code:
if(browserCheck() == 0) {
header("Content-type: text/vnd.wap.wml");
}
else {
header("Content-type: text/html");
}
It's really important that I figure out how to differentiate between headers because if the mobile device requires a text/html header - then I must use an html form to gather user imput.....if it requires a wap header, then I must use a wap form.....but when I send the wap header on about half of the phones I have tried this on I get a "page cannot be displayed" on the screen.....so any help you guys can provide would be greatly appreciated. I also don't know if this matters but the WAP pages contains a small jpg logo. Could that have some issue with the header? Last edited by askjoe : April 11th, 2006 at 06:43 PM. |
|
#2
|
||||
|
||||
|
Hi,
YOu are assuming that people browsing your site are only using IE or Fx when using a web browser? Check to see whether the device accepts html or just wml too. Code:
$_SERVER['HTTP_ACCEPT'] In fact, I would check that first, then determine what browser (if that is really necessary) the user is browsing with. You can also check whether the device accepts jpg's or not and display accordingly. IIRC, gifs may be a better option (smaller generally anyway). User agent can be faked (as can most headers) ![]() Give the search button a bit of abuse. This forum provides on or two methods for doing this kind of thing ![]() Hope that helps.
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure # Any form of employment is strictly prohibited ...... __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. __________________ Last edited by jabba_29 : April 11th, 2006 at 07:49 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > WAP/WML headers and site not being displayed. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|