Skip to content

Commit

Permalink
fix checking User-Agent for Mobiles
Browse files Browse the repository at this point in the history
  • Loading branch information
nobody9 committed Jan 1, 2012
1 parent 23973a8 commit 2373b50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugin/controllers/root.py
Expand Up @@ -46,7 +46,8 @@ def prePageLoad(self, request):
# the "pages functions" must be called P_pagename
# example http://boxip/index => P_index
def P_index(self, request):
if request.getHeader("User-Agent").find("iPhone") != -1 or request.getHeader("User-Agent").find("iPod") != -1:
uagent = request.getHeader('User-Agent')
if uagent.find("iPhone") != -1 or uagent.find("iPod") != -1:
request.setHeader("Location", "/mobile/")
request.setResponseCode(http.FOUND)
return ""
Expand Down

0 comments on commit 2373b50

Please sign in to comment.