473,800 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to detect page request is from mobile or PC?

18 New Member
Hi Everybody,

I have developed a website using PHP, which will produce HTML code.

But I have some pages in PHP ,which will produce WML code for mobile browsers.

I want to redirect to WML page,if the site is accessed from the mobile. Otherwise it should display HTML page if the site is accessed from Desktop PC.

Please do reply me.

Arun.
Apr 4 '07 #1
4 5675
michaelb
534 Recognized Expert Contributor
I think you could use a simple javascript code to detect the client
(run a Google search for "javascript browser detection")
and redirect accordingly.
Apr 4 '07 #2
dhillarun
18 New Member
I think you could use a simple javascript code to detect the client
(run a Google search for "javascript browser detection")
and redirect accordingly.
As the javascript is running in the client side,some mobile browsers will not support "Javascript ". So I want to achieve the same in the server side itself.

(i.e) In the server, I want to know which device (whether mobile or Desktop Computer) is acessing the website.

If the device accessing the website is a mobile or PDA , then it should redirect into a PHP page which will produce WML code.

Otherwise if the request is from computer, then it should redirect into a PHP page which will produce HTML code.
Apr 5 '07 #3
michaelb
534 Recognized Expert Contributor
>> ... some mobile browsers will not support "Javascript ".
Sorry, I overlooked this.

Back to the server code, when you use a mobile device is $_SERVER['HTTP_USER_AGEN T'] gets some meaningful value?
Apr 5 '07 #4
joshe766
2 New Member
Hi Everybody,

I have developed a website using PHP, which will produce HTML code.

But I have some pages in PHP ,which will produce WML code for mobile browsers.

I want to redirect to WML page,if the site is accessed from the mobile. Otherwise it should display HTML page if the site is accessed from Desktop PC.

Please do reply me.

Arun.




this is the script....this is s php type...





<?php
/////////////////////////////////////////////////////////////////////////////
///*************** *************** *************** *************** ******///////
///*PROYECTO WAP CONSULTA DE NOTAS-CORPORACION UNIVERSITARIA DE CIENCIA*////
///*Y DESARROLLO UNICIENCIA-EXTENSION BUCARAMANGA.*** *************** ***////
///*TESIS PRESENTADA POR: JOSE ALVAREZ VERGARA-INGENIERIA INFORMATICA*////
///*************** *************** *************** *************** ********//
////////////////////////////////////////////////////////////////////////

//PROTECCION DE NAVEGADOR
$user = explode ('/', $HTTP_USER_AGEN T);
//EL ACCESO ESTA DENEGADO PARA CUALQUIERA DE ESTOS NAVEGADORES Y SERA REDIRECCIONADO A LA PAGINA PRINCIPAL DE LA U
if($user[0]=="Opera"||$use r[0]=="Mozilla"||$u ser[0]=="Go!Zilla"||$ user[0]=="Netscape"||$ user[0]=="MSIE"){
//PAGINA COMPATIBLE A LA CUAL SE REDIRECCIONA
header ('Location: http://www.unicienciab ga.edu.co/wap/error.php');}

//EN CASO QUE SEA UN NAVEGADOR WAP COMPATIBLE SE PERMITIRÁ EL ACCESO
include("parame tros.inc");
?>

<wml>
<card ontimer='inicio .wml#main' title='<? echo $SITENAME; ?>'>
<timer value="50"/>
<p align='center'>
<small> SISTEMA WAP<br/>
<strong>Unicien cia Bucaramanga</strong></small><br/>

<img src="./images/uniciencia.jpg" alt="Uniciencia "/><br/>

<small>Educacio n Integral de Optima Calidad</small><br/>
<small><a href='inicio.wm l#main'>Ingresa r</a></small>
</p>

</card>
</wml>
Jun 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3359
by: ripken95 | last post by:
I connect to the internet through ADSL. I want to write the web page which can detect the connection status with javascript. This detection is like the signal detection in the mobile phone. If the signal is weak, the status may have one squares or zero on the phone. How could I do if I want to detect the status of the network? Thx and Best Regards.
3
9139
by: Sara | last post by:
HI, I want to code a program to detect GSM mobile (any kind) which connected through serial port to computer and then be able to send SMS through this mobile phone to other mobile phones, could anyone help me and guide me, I wrote a program which could open COM port but still couldn't detect mobile phone and send SMS through it. I searched internet and I didn't find right answer to my question. please if anyone could guide me. the...
6
5243
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
3
4584
by: Carlos | last post by:
Hi all, I was just trying to execute sample code to redirect the output to a mobile page from a Pocket PC but it did not work. I tried from the root aspx file (page_load event): if (Request.Browser == "true" ) Response.Redirect("indexm.htm"); else
4
7015
by: Sara | last post by:
Hi I want to code a program which could send SMS through web page to mobile phone, but because there is no Service here such as SMPP , therefore I have GSM mobile phone which connected directly to the server which run these aspx pages. now my question is 1- how to detect this mobile phone which connected through serial ports 2- how I could send SMS through this mobile to other mobile devices, if anyone has any suggestion please help me
4
1971
by: SJ | last post by:
I have a mobile web application running on a server at work. There is a strange thing happening though: 1) I can access and login to my mobile web app from any internet browser. (good thing). 2) I can access and login to my mobile web app from any Palm Treo web browser. (good thing). 3) When I use a regular mobile phone (samsung/motorola...etc) and load up my website on the browser, it takes me to the login page. Now, when I enter my...
4
1973
by: David Thielen | last post by:
Hi; This is for a website that is just html pages, no ASP.NET. I want the default page to be a different page if it's a mobile device. I can do this in ASP.NET by looking at the browser size and redirecting. But is there a way in IIS to point it to different page(s) for mobile devices? thanks - dave
8
12626
by: barrybee | last post by:
PHP version 4.027 I want to change between style sheets when page is viewed on a mobile phone or a PC. The pages looks fine on both when I manually set a key in the script. My problem is how to determine if its viewed on a phone or PC. I have used $_SERVER; to show the browser details RESULTS from php pages. HTC Mobile phone;
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.