aboutsummaryrefslogtreecommitdiff
path: root/posts
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2021-12-31 00:59:03 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2021-12-31 00:59:03 +0100
commit179f9ad3b95a9bbdc45f1982af6c4b6169488a13 (patch)
tree8529d6d8c4c2fdbc90bc1e69a4113cb11e01e61e /posts
parentfcfec0c05b3a082c01ef26e01b8587b905c51ee2 (diff)
downloadmitjafelicijan.com-179f9ad3b95a9bbdc45f1982af6c4b6169488a13.tar.gz
Added nerw post
Diffstat (limited to 'posts')
-rw-r--r--posts/2021-12-30-wap-mobile-web-before-the web.md158
1 files changed, 158 insertions, 0 deletions
diff --git a/posts/2021-12-30-wap-mobile-web-before-the web.md b/posts/2021-12-30-wap-mobile-web-before-the web.md
new file mode 100644
index 0000000..1ebe78c
--- /dev/null
+++ b/posts/2021-12-30-wap-mobile-web-before-the web.md
@@ -0,0 +1,158 @@
1---
2Title: Wireless Application Protocol and the mobile web before the web
3Description: Wireless Application Protocol and the mobile web before the web
4Slug: wap-mobile-web-before-the-web
5Listing: true
6Created: 2021-12-30
7Tags: []
8---
9
101. [A little stroll down the history lane](#a-little-stroll-down-the-history-lane)
112. [WAP or Wireless Application Protocol](#wap-or-wireless-application-protocol)
123. [WML or Wireless Markup Language](#wml-or-wireless-markup-language)
134. [Converting Digg to WML](#converting-digg-to-wml)
145. [Conclusion](#conclusion)
15
16## A little stroll down the history lane
17
18About two weeks ago, I watched this outstanding documentary on YouTube [Springboard: the secret history of the first real smartphone](https://www.youtube.com/watch?v=b9_Vh9h3Ohw) about the history of smartphones and phones in general. It brought back so many memories. I never had an actual smartphone before the Android. The closest to smartphone was [Sony Ericsson P1](https://www.gsmarena.com/sony_ericsson_p1-1982.php). A fantastic phone and I broke it in Prague after a party and that was one of those rare occasions where I was actually mad at myself. But nevertheless, after that phone, the next one was an Android one.
19
20Before that, I only owned normal phones from Nokia and Siemens etc. Nothing special, actually. These are the phones we are talking about. Before 2007. Apple and Android phones didn't exist yet.
21
22- No selfie cameras.
23- ~2 inch displays.
24- ~120 MHz beast CPU's.
25- 144p main cameras.
26- But they had a headphone jack.
27
28
29![](/assets/wap/phones.jpg)
30
31## WAP or Wireless Application Protocol
32
33Not that one! We are talking about Wireless Application Protocol and not Cardi B's song 😃
34
35WAP stands for Wireless Application Protocol. It is a protocol designed for micro-browsers, and it enables the access of internet in the mobile devices. It uses the mark-up language WML (Wireless Markup Language and not HTML), WML is defined as XML 1.0 application. Furthermore, it enables creating web applications for mobile devices. In 1998, WAP Forum was founded by Ericson, Motorola, Nokia and Unwired Planet whose aim was to standardize the various wireless technologies via protocols. [(source)](https://www.geeksforgeeks.org/wireless-application-protocol/)
36
37WAP protocol was resulted by the joint efforts of the various members of WAP Forum. In 2002, WAP forum was merged with various other forums of the industry, resulting in the formation of Open Mobile Alliance (OMA). [(source)](https://www.geeksforgeeks.org/wireless-application-protocol/)
38
39These were some wild times. Devices had tiny screens and data transmission rates were abominable. But they were capable of rendering WML (Wireless Markup Language). This was very similar to HTML, actually. It is a markup language, after all.
40
41These pages could be served by [Apache](https://apache.org/) and could be generated by CGI scripts on the backend. The only difference was the limited markup language.
42
43## WML or Wireless Markup Language
44
45Just like web browsers use HTML for content structure, older mobile device browsers use WML - if you need to support really old mobile phones using WML browsers, you will need to know about it. WML is XML-based (an XML vocabulary just like XHTML and MathML, but not HTML) and does not use the same metaphor as HTML. HTML is a single document with some metadata packed away in the head, and a body encapsulating the visible page. With WML, the metaphor does not envisage a page, but rather a deck of cards. A WML file might have several pages or cards contained within it. [(source)](https://www.w3.org/wiki/Introduction_to_mobile_web)
46
47```html
48<?xml version="1.0"?>
49<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
50<wml>
51 <card id="home" title="Example Homepage">
52 <p>Welcome to the Example homepage</p>
53 </card>
54</wml>
55```
56
57There is an amazing tutorial on [Tutorialpoint about WML](https://www.tutorialspoint.com/wml/index.htm).
58
59## Converting Digg to WML
60
61This task is completely useless and not really feasible nowadays, but I had to give it a try for old-time sake. Since the data is already there in a form of RSS feed, I could take this feed and parse it and create a WML version of the homepage.
62
63We will need:
64
65- Python3 + Pip
66- ImageMagick
67- feedparser and mako templating
68
69```sh
70# for fedora 35
71sudo dnf install ImageMagick python3-pip
72
73# tempalting engine for python
74pip install mako --user
75
76# for parsing rss feeds
77pip install feedparser --user
78```
79
80Project folder structure should look like the following.
81
82```
8312:43:53 m@khan wap → tree -L 1
84.
85├── generate.py
86└── template.wml
87
88```
89
90After that, I created a small template for the homepage.
91
92```html
93<?xml version="1.0"?>
94<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.xml">
95
96<wml>
97
98 <card title="Digg - What the Internet is talking about right now">
99
100 % for item in entries:
101 <p><img src="/images/${item.id}.jpg" width="175" height="95" alt="${item.title}" /></p>
102 <p><small>${item.kicker}</small></p>
103 <p><big><b>${item.title}</b></big></p>
104 <p>${item.description}</p>
105 % endfor
106
107 </card>
108
109</wml>
110```
111
112And the parser that parses RSS feed looks like this.
113
114```python
115import os
116import feedparser
117from mako.template import Template
118
119os.system('mkdir -p www/images')
120
121template = Template(filename='template.wml')
122
123feed = feedparser.parse('https://digg.com/rss/top.xml')
124
125entries = feed.entries[:15]
126
127for entry in entries:
128 print('Processing image with id {}'.format(entry.id))
129 os.system('wget -q -O www/images/{}.jpg "{}"'.format(entry.id, entry.links[1].href))
130 os.system('convert www/images/{}.jpg -type Grayscale -resize 175x -depth 3 -quality 30 www/images/{}.jpg'.format(entry.id, entry.id))
131
132html = template.render(entries = entries)
133
134with open('www/index.wml', 'w+') as fp:
135 fp.write(html)
136```
137
138This script will create a folder `www` and in the folder `www/images` for storing resized images.
139
140> Be sure you don't use SSL and use just normal HTTP for serving the content. These old phones will have problems with TLS 1.3 etc.
141
142If you look at the python file, I convert all the images into tiny B&W images. They should be WBMP (Wireless BitMaP) but I choose JPEGs for this, and it seems to work properly.
143
144Because I currently don't have a phone old enough to test it on, I used an emulator. And it was really hard to find one. I found [WAP Proof](http://wap-proof.sharewarejunction.com/) on shareware junction, and it did the job well enough. I will try to find and actual device to test it on.
145
146<video src="/assets/wap/emulator.mp4" controls></video>
147
148If you are using Nginx to serve the contents, add a directive to the hosts file that will automatically server `index.wml` file.
149
150```nginx
151server {
152 index index.wml index.html index.htm index.nginx-debian.html;
153}
154```
155
156## Conclusion
157
158Well, this was pointless, but very fun! You can [give it a try on digg.mitjafelicijan.com](digg.mitjafelicijan.com) but make sure you are using a browser or old emulator that supports WML.