Ticket #3441 enhancement closed wontfix
Include "meta viewport" in DirectoryListing output to better support iPhone
| Reported by: | russryba | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | web | Keywords: | iPhone, iPod touch, webkit, viewport |
| Cc: | thijs | Branch: | |
| Author: | Launchpad Bug: |
Description
Problem:
When using simple mktap web to browse directories, the pages do not format well on iPhone or iPod touch.
Root Cause:
The cause of this problem is that iPhones expect a meta tag to be set to define the viewport dimensions of the device. This is part of the CSS specification that defines the size of the view window separate from the size of the page itself.
Solution:
Adding a meta tag that defines the viewport appears to fix this problem. Tested locally with iPod Touch firmware 2.1.
Adding this line...
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, width=device-width">
...to twisted\web\woven\dirlist.py fixes this problem. This was at line 26 in my version, result source code is below.
class DirectoryLister(page.Page):
template = '''
<html>
<head>
<title model="header"> </title>
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, width=device-width" />
<style>
Searching for '<head>' I see several other places where adding this meta tag would be helpful. I know my source code is out of date so I will leave it to the developers to figure out where this should go in the latest code.
