ispras / web-scraper-chrome-extension

Web data extraction tool implemented as chrome extension
GNU Lesser General Public License v3.0
214 stars 68 forks source link

Access data dynamicly for relevant sites #73

Open jNullj opened 4 years ago

jNullj commented 4 years ago

Currently the manifest requires permision for all urls. Some users might prefer least needed permisions from the app. A solution for that might be adding that permision as an optional permission and asking user to add permission for data of new sites added to the extention.

example for making data for domains an optional permission that can be asked later from the running extention at runtime: manifest.json

...
"optional_permissions": [ "http://*/", "https://*/"  ]
...

example for asking permission for a new site at runtime:

    chrome.permissions.request({
    origins: [protocol +"://"+ domain +":"+ port+"/"]
    }, function(granted) {
        // The callback argument will be true if the user granted the permissions.
        if (granted) {
            alert("amazing things happend here")
        } else {
            alert("Without permision to the site the app can't work")
        }
    });