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! | You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David 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!
| | | | Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations. FREE! Go There Now!
| | | | 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!
| | | | Download a free trial version of IBM Rational Software Analyzer Developer Edition V7.0 to identify bug defects earlier in the software development cycle. Rational Software Analyzer is an extensible software development solution that reduces the expense of bug-fixes by enabling static analysis code reviews and bug identification very early in the development cycle. 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!
| | | | In this tutorial, you can learn how to install and configure the IBM Rational Asset Manager Eclipse client, explore the different views in the Asset Management perspective, learn various search techniques, work with existing assets, and submit a new asset. FREE! Go There Now!
| | | | Ken Krugler, co-founder of code search company Krugle, and Laura Merling, vice president of Marketing and Business Development for Krugle, join to talk about the ins and outs of code search and what it means as a new feature for developerWorks users. FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference, to hear how Enterprise Generation Language (EGL) eliminates the need for tedious and error-prone low level coding, so developers can focus on business requirements. EGL extends the Rational software development platform with a simplified programming language that enables developers who have little or no experience with Java, Web technologies or Service Oriented Architecture, to create enterprise-class applications and services quickly and easily. It also allows developers who may have little or no mainframe programming experience to quickly create traditional mainframe components. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |