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! | Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development FREE! Go There Now!
| | | | This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer. FREE! Go There Now!
| | | | Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms. FREE! Go There Now!
| | | | Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization. FREE! Go There Now!
| | | | Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications. FREE! Go There Now!
| | | | Visit IBM developerWorks to download a free trial of the Rational Host Access Transformation Services (HATS) Toolkit. The HATS toolkit provides a set of plug-ins for the IBM Rational Software Delivery Platform to help you easily extend your legacy applications. HATS makes your 3270 and 5250 applications available as HTML through the most popular Web browsers, while converting your host screens to a Web look and feel and it also enables you to develop new Web, portal, and rich-client applications. FREE! Go There Now!
| | | | Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services. FREE! Go There Now!
| | | | Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly. FREE! Go There Now!
| | | | Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
| | | | WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |