Generic WebPages Using WAP | |
|
| | Here I will explain how to implementing WAP to work on traditional browser and Mobile devices using ASP. although I personally feel XML would be the best approach for this kind of work. Well this is my attempt to allow users to access same page from IE, NN, Nokia and UP Browsers. Since HTML tags and WML tags are little different in syntax the only common tag I see is <A> anchor tag. you can have graphics when you are displaying on traditional browsers, but i have not done this is my example. | [ Jignesh.asp ] <% agent = Request.servervariables("http_user_agent") if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.ContentType = "text/vnd.wap.wml" Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">") Response.write("<wml><card>") else Response.ContentType = "text/html" Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>" end if
Response.write "<p align=""center"">Welcome</p>" Response.write "<p align=""center"">Jignesh consultancy</p>" Response.write "<p><a href=""training.asp""> Training </a></p>" Response.write "<p><a href=""webd.asp""> Web Development </a></p>" Response.write "<p><a href=""Home.asp""> Jignesh's Home </a></p>" Response.write "<p>Email: codehunt@yahoo.com</p>" if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.write("</card></wml>") else response.write "</body></html>" end if %> | | Things are pretty simple here Request.servervariables("http_user_agent") will return what browser "client" is using. if you run this code on Nokia toolkit it returns "Nokia-WAP-Toolkit/1.3beta" while UP. Browser returns "UPG1 UP/4.0.4g". so we well find out what is the value of 'agent' variable, if it is matching above two we will throw WML contant from asp file else assume client is a traditional browser and we will throw HTML content. you might wonder why I am using </p> tag in every statement and not <br>. the answer is as per WML specification empty tags syntax is "<br/> which is perfectly fine for IE but not for NN (atleast ver 4.5 ). if you are planning to support all versions of browser then this is the best. This remains same for all other remaining ".asp" files in this article. source code of other .asp files are listed below. | [ Training.asp ] <% agent = Request.servervariables("http_user_agent") if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.ContentType = "text/vnd.wap.wml" Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">") Response.write("<wml><card>") Response.write("<do type=""accept"" label=""Go!"" optional=""false"" >") Response.write("<prev/></do>") else Response.ContentType = "text/html" Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>" end if
Response.write "<p align=""center"">Welcome</p>" Response.write "<p align=""center"">Jignesh consultancy</p>" Response.write "<p>Higher End Training on Site Server, WAP, ASP-IIS, Oracle8i.</p>" Response.write "<p> (091)-(022)-(8638399) </p>" if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.write("</card></wml>") else response.write "</body></html>" end if %> | | [ WebD.asp ] <% agent = Request.servervariables("http_user_agent") if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.ContentType = "text/vnd.wap.wml" Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">") Response.write("<wml><card>") Response.write("<do type=""accept"" label=""Go!"" optional=""false"" >") Response.write("<prev/></do>") else Response.ContentType = "text/html" Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>" end if
Response.write "<p align=""center"">Welcome</p>" Response.write "<p align=""center"">Jignesh consultancy</p>" Response.write "<p>[ Web Development Rs.300 and Hosting with fast servers] </p>" Response.write "<p> (091)-(022)-(8638399) </p>" if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.write("</card></wml>") else response.write "</body></html>" end if %> | | [ Home.asp ] <% agent = Request.servervariables("http_user_agent") if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.ContentType = "text/vnd.wap.wml" Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">") Response.write("<wml><card>") Response.write("<do type=""accept"" label=""Go!"" optional=""false"" >") Response.write("<prev/></do>") else Response.ContentType = "text/html" Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>" end if
Response.write "<p align=""center"">Welcome</p>" Response.write "<p align=""center"">Jignesh consultancy</p>" Response.write "<p>C/204 Patel Nagar, 4.M.G. Cross Road, Kandivali (west), Mumbai 400067, India</p>" Response.write "<p> (091)-(022)-(8638399) </p>" if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then Response.write("</card></wml>") else response.write "</body></html>" end if %> | | That's it!. Enjoy and download code to see live. or check live from your simulator by pointing here http://www.web-tech.atfreeweb.com/default.asp | See my other article "Booking Movie Tickets on Mobile Phone" |
|
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Code Examples Articles More By aspfree developerWorks - FREE Tools! | David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. FREE! Go There Now!
| | | | As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper. FREE! Go There Now!
| | | | CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP. FREE! Go There Now!
| | | | Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server. FREE! Go There Now!
| | | | Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7. FREE! Go There Now!
| | | | Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms. FREE! Go There Now!
| | | | Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs). FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications. FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services. FREE! Go There Now!
| | | | The discipline of assembling and delivering software is maturing beyond standard developer-centric compile/test software builds. The end-to-end software development lifecycle is emerging as the new focus moves “Beyond the Build.” Join this on demand webcast to learn about methods for streamlining software delivery and key capabilities of the IBM Rational Build Forge framework for automating build and release management in environments of any size. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |