Quote:
Originally Posted by PlausiblyDamp
|
Thanks for that!
Two main reasons, my website works much better on Chrome and Firefox (MIE opens a new Window when really a Tab suits much better)
Secondly, the Right click to save is different for each type and I thought I would customise it so
If Firefox "Save Link As ..."
If Opera "Save Linked Content As"
etc etc
[Edit] This is tricky because:
Chrome refers to Safari in the string
MSIE refers to Chrome in the string
Opera refers to Firefox and MSIE in the string
So, here is my final code in case it helps somebody
Code:
Function BrowserName 'as String
dim strContent 'as String
strContent = Request.ServerVariables("HTTP_USER_AGENT")
strContent = lcase(strContent)
'FIRST: Test for Opera
'Note: Opera is the ONLY popular browser that refers to "Opera"
if instr(strContent, "opera") > 0 then
BrowserName = "Opera"
exit function
end if
'SECOND: Test for Explorer
'Note: Opera MAY contain a reference to MSIE but Opera has ALREADY been found
if instr(strContent, "msie") > 0 then
BrowserName = "MSI Explorer"
exit function
end if
'THIRD: Test for "Firefox"
'Note: Opera MAY contain a reference to "Firefox" but Opera has ALREADY been found
if instr(strContent, "firefox") > 0 then
BrowserName = "Firefox"
exit function
end if
'FOURTH: Test for "Chrome"
'Note: MSIE MAY contain a reference to "Chrome" but MSIE has ALREADY been found
if instr(strContent, "chrome") > 0 then
BrowserName = "Chrome"
exit function
end if
'FIFTH: Test for "Safari"
'Note: Chrome MAY contain a reference to "Safari" but Chrome has ALREADY been found
if instr(strContent, "safari") > 0 then
BrowserName = "Safari"
exit function
end if
'If still here ... other
BrowserName = "Another Browser"
end function
.
.