0

method 1:

<script type="text/javascript">
if ('serviceWorker' in navigator)
  {
    navigator.serviceWorker.register('service_worker/worker.js').catch(function(err) 
    {
    console.log('Error installing service worker: '+ err);
    });
}
</script>

this is the code i initially started with ..i added this script in my index.html in www/ folder.. it didn't work coz ionic serve will run on 192.168.0.103 which is not a secure origin

Later i uploaded the file to git and then got the raw url

method 2:

   navigator.serviceWorker.register('https://raw.githubusercontent.com/gavicharla/service_worker/master/worker.js')

this too didnt work though the protocol was https .. it said the origin is not secure ..

method 3:

i ran ionic run android and installed the app into my phone after using method 1 .. then it said

 the origin (file:// ) is not supported whilst the website said it is ...

method 4:

i ran a python webserver with https using a self signed certificated .. it showed an X in the chrome browser and the error is back saying the origin is not secure ..

please do help me .. thanks in advance !! :)

0 Answers0