In this blog, we are going to learn How To Detect MS-Edge Extension Using JS.
- Every Edge extension has a unique ID from which we will identify the extension.
- Every Edge extension also has a manifest.json File.
- The difference between chrome and MS-edge is all about the extension ID.
Step 1: – Get The ID of the extension, open the extension manager in the Edge browser, and open the detail page of that extension.
Step 2:- Create a Function in your js file Namely UrlExists().
function UrlExists(url, cb) { $.ajax({ url: url, dataType: 'text', type: 'GET', complete: function (xhr) { if (typeof cb == 'function') cb.apply(this, [xhr.status]); } }) }
This function will return status 200 if the manifest.json file is found.
Step3:- Create a URL as per your Extension ID: chrome-extension://YOUR EXTENSION ID/manifest.json
Step4:- now call UrlExists() function by giving your URL
UrlExists('chrome-extension://YOUR EXTENSION ID/manifest.json', function (status) { if (status == 200) { alert('Extension Detected') } else{ alert('Extension Not Found') } })
In the end, it will look like following
function UrlExists(url, cb) { $.ajax({ url: url, dataType: 'text', type: 'GET', complete: function (xhr) { if (typeof cb == 'function') cb.apply(this, [xhr.status]); } }) } UrlExists('chrome-extension://YOUR EXTENSION ID/manifest.json', function (status) { if (status == 200) { alert('Extension Detected') } else{ alert('Extension Not Found') } })
Check out the chrome extension detection Blog: – Click Here