4

We are writing a website in C#, and we need to detect if the client's browser has a certain (custom developed) add-on installed.

We have figured out a way how to do it when the client is using Firefox or Internet Explorer. How can we do the same with Safari and Chrome?

Yousuf Jawwad
  • 3,037
  • 7
  • 33
  • 60

2 Answers2

0

Since addons have permission to modify DOM
using the add-on you can inject some javascript variable(e.g. var IsMyAddonNameInstalled = 'true') into the DOM when your website is requested from browser
and then pass it to server using AJAX request or hidden input field.

PS: This will work on all browsers

Nitin Sawant
  • 7,278
  • 9
  • 52
  • 98
0

You can add your Addon name to User-Agent variable of your browser (by modyfing this value in browser settings store, open about:config in URL for Firefox). Then you can read it back from Request object.

Dariusz
  • 15,573
  • 9
  • 52
  • 68
  • If the UserAgent string gets too long, it can become truncated and information is lost. – Jeff Yates May 17 '11 at 14:54
  • @Jeff Yates. There is no limitation on HTTP side for that. Do you know any? – Dariusz May 17 '11 at 15:00
  • Or (depending on the capabilities of the plugin) add it as a custom (X-*) header. – Benjamin Podszun May 17 '11 at 15:00
  • Maybe not, but it happens on Windows. I had that issue several times and it caused some weird issues as [ASP.NET truncates the User Agent string to 256 characters](http://blogs.msdn.com/b/psssql/archive/2008/12/29/failure-to-load-report-manager-due-to-truncated-useragent-string.aspx). I wouldn't rely on it. – Jeff Yates May 17 '11 at 15:09