Welcome Guest, Not a member yet? Register   Sign In
cannot access file in root of project
#1

(This post was last modified: 05-26-2018, 03:41 AM by majortom84.)

I am trying to get the access to a js file that has to be in root for it to work.

/mysite.com
/myapp
/root
->index.php
->upup.sw.js
/application

How can I reach this file? 

JS calling the script:
var _settings = {
    'service-worker-url': '/upup.sw.js'
  };

htaccess in root: 
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 

vhost: 
Options FollowSymLinks MultiViews
   AllowOverride All
   Require all granted

REF: 
https://github.com/TalAter/UpUp
Where Should I Place My Files?
For security reasons, the browser only lets UpUp's service worker see network requests within its scope.

The scope that the service worker can affect is determined by where you placed upup.min.js and upup.sw.min.js. For example, if you place it on https://yoursite.com/js/upup.sw.min.js, UpUp will only be able to show your offline content when users try to look at the /js/ directory.

This is why it is important to place both files on the same server as your content, and not in a subdirectory. This should idealy be in the root of your site (e.g. https://yoursite.com/upup.min.js).
Reply




Theme © iAndrew 2016 - Forum software by © MyBB