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!
| | | | Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan. FREE! Go There Now!
| | | | Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
| | | | Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base. FREE! Go There Now!
| | | | You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months. FREE! Go There Now!
| | | | Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions. 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!
| | | | Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
| | | | This paper is about the critical role that a discipline called integrated requirements management can play in helping to ensure that your business goals and IT investments are continuously aligned—whether you are sourcing, integrating, building or maintaining software. It also looks at ways that automated IBM Rational® products can work together to help you use requirements in the very best way. FREE! Go There Now!
| | | | You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |