web-scraper-chrome-extension icon indicating copy to clipboard operation
web-scraper-chrome-extension copied to clipboard

Access data dynamicly for relevant sites

Open jNullj opened this issue 4 years ago • 0 comments

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")
		}
	});

jNullj avatar Oct 05 '20 11:10 jNullj