this is how things work in my website a.com , users visits my website i talk to api in another website b.com using my account , generate a link b.com/somelink and redirect user to that link
here is the problem , this address b.com/somelink contain some private information which i want to hide from visitors ... since i dont control that website i cant to that
so i thought best option would be an browser extension , users should install the extension before redirecting to b.com
so here is my simple extension
manifest.json
{
"name": "extname",
"version": "1.0",
"description": "extnameExtension!",
"manifest_version": 2,
"permissions": [
"tabs", "http://*/*", "https://*/*" , "webNavigation"
] ,
"content_scripts": [
{
"matches": ["*://b.com/*"],
"js": ["contentscript.js"],
"run_at": "document_start"
}
]
}
contentscript.js
function fireOnReady() {
document.getElementById('personal-info').innerHTML = 'some dummy data';
}
if (document.readyState === 'complete') {
fireOnReady();
} else {
document.addEventListener("DOMContentLoaded", fireOnReady);
}
which is working fine , i hvae 2 problems
1 - users might disable the extension and refresh the page b.com/somelink and see my personal info .... so my solution is to close browser tab opening b.com if they remove my extension ... is there any way to do this ? (this link is only available if they redirected from my website to b.com so they cant just copy/paste the link in new tab/browser )
2 - in my own website , how can i make sure they have installed my extension before redirecting them to b.com ?
**pleas lets not talk about scenario that i explained or other solution or ...i know this might sound odd , but this is not intended for public users but private special group who will install extension if they have to , im interested to know how to do this with code and extensions even if i finde another solution **
from check if extension is installed , and close tab if user remove extension
No comments:
Post a Comment