Hi,

I use web2py to serve PWA, service worker for client-side caching and for 
proactive loading of contents which are likely to be requested in the next 
step. 

In routes.py I have root_static = ['favicon.ico', 'robots.txt', 
'service_worker.js']. 

Per-app specific service worker. The script is visible to the client (which 
is common for client-side JS, isn't it?). If you don't like it you may 
consider something like https://javascript-obfuscator.org/ .

Layout like this:

<!DOCTYPE html>
<html>
<head>
    <title>{{=response.title}}</title>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="width=device-width, 
initial-scale=1.0">    
    <link rel="manifest" href="{{=URL('static','viewer_manifest.json')}}" />

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="application-name" content=" ... ">
    <link rel="icon" sizes="192x192" href="{{=URL("static", 
"/images/icons/icon-192x192.png")}}">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content=" ... ">
    <link rel="apple-touch-icon" href="{{=URL("static", 
"/images/icons/icon-192x192.png")}}">

    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="{{=URL("static", 
"/images/icons/icon-144x144.png")}}">
    <meta name="msapplication-TileColor" content="#2196f3">

    <!-- Color the status bar on mobile devices -->
    <meta name="theme-color" content="#2196f3">

    <link rel="stylesheet" href="{{=URL('static','css/viewer.css')}}"/>
    <link rel="stylesheet" href="{{=URL('static','css/arrows.css')}}"/>
    <!-- icon generator https://app-manifest.firebaseapp.com/ -->
    
    <link rel="stylesheet" href="{{=URL('default', 
'cust_static',args=('viewer.css',))}}"/>

    {{if 'cust_style' in response:}} {{=XML(response.cust_style)}} {{pass}}
</head> 
<body>

<script src="{{=URL('static','js/jquery.js')}}"></script>    
<script src="{{=URL('static','js/fittext-flex.js')}}"></script>    

{{if 'cust_js' in response:}}<script>{{=XML(response.cust_js)}}</script> 
{{pass}}

{{include}}

{{block page_js}}{{end page_js}}

<script src="{{=URL('static','js/ct_viewer.js')}}"></script>

</body>
</html>

David

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f7b88230-e6a6-413c-864e-dc85c9a4cffb%40googlegroups.com.

Reply via email to