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! | Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications. FREE! Go There Now!
| | | | Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
| | | | Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
| | | | Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services. FREE! Go There Now!
| | | | This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
| | | | IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects. FREE! Go There Now!
| | | | Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code. FREE! Go There Now!
| | | | Get a free trial download of IBM Lotus Forms V3.0 (formerly Workplace Forms), which provides a zero-footprint eForms solution to help you automate and move forms-based business processes off the desktop and onto the Web. With Lotus Forms, you can extend applications beyond the firewall by creating a single electronic form document ready for use in both thick and Web 2.0 thin client format. FREE! Go There Now!
| | | | As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security. FREE! Go There Now!
| | | | IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |