If you are the author of the extension, then you can detect if your own extension is installed. I simply inject an invisible string into my website which I then scan for when the page is loaded. If the string has been injected, my extension must be installed and you can then do whatever you like with the result.
identifier.js
if (window.top === window)
{
//detect if the extension has been installed and disable "Install" button if that's the case
if (document.title === "YOUR PAGE TITLE") //we don't want to inject the string into any website, just ours
{
var p = document.createElement("noscript");
var texto = document.createTextNode("Extension Installed");
p.appendChild(texto);
document.body.appendChild(p);
}
}
I suspect Apple does this programmatically using the WebView that Safari uses to display websites and then runs javascript scripts internally that change the Extensions website depending on the extensions returned in Safari's code.
Hope this helps!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…