Q: Why do I get an error message when using Opera on
FullXML-driven sites?
A: Short answer; In Opera after accessing the page,
press F12, choose "Identify as Opera" and
reload (F5).
A bit more extensive answer;
This problem occurs due to a bug in the browser
selection script in FreeXML, resident in
the file /Engine/CBrowser.asp. See below for the
attached script.
Generally, browser detection is done by inspecting the
User Agent string the browser
sends. Examples of UA-strings that Opera sends (in
different modes):
"Opera/8.0 (Windows NT 5.1; U; en)"
or
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en)
Opera 8.0"
What goes wrong is the version control in the script, but
only if the second mentioned UA-
string is sent from Opera. You can (as mentioned in the
short answer above) select which
UA-string to use by pressing F12 on a page, and choose
"Identify as Opera". From Opera
version 8.02, this is the default setting.
The script explained;
First (on line 22) the MSIE-part is detected with instr.
Then (on line 24) it checks for OPERA (in the uppercase
version of the UA-string) and
finds it on position 56, and sets Browser="OP".
On line 26 a temporary string is assigned with the Mid()
of the UA-string, from position
56+6=62 (see above), and to the end of the UA-string.
The str variable now equals "8.0"
On line 27 (the error mentioned) the str variable is
checked for a space:
Version = Mid(str, 1, instr(str, " ")-1)
The instr function will not find a space, thus returning (int)
0. The Mid-function then
gets (partially evaluated);
Version = Mid("8.0", 1, -1), where the third parameter is
the optional length parameter.
This can of course not be -1, so the function fails.
To detect Opera correctly, you will need more changes in
the script. The current default
UA-string will look something like; "Opera/8.02 (Windows
NT 5.0; U; en)". With the
CBrowser.asp (also included in FullXML 2.3 Beta 2),
Opera will be detected as Netscape 6
(Browser = "NS6"), due to the lack of "MSIE" in the UA-
string. (See the first test, line
22 of CBrowser.asp).
Best regards,
-Henrik
-------------------------------------------
Snip of the Sniff function in CBrowser.asp:
-------------------------------------------
Private Sub Sniff
Dim str
UserAgent = UCASE(Request.
servervariables("HTTP_USER_AGENT"))
if instr(UserAgent, "MSIE")>0 then
' Opera case
if instr(UserAgent, "OPERA")>0 then
Browser = "OP"
str = Mid(UserAgent, instr(UserAgent, "OPERA")+6)
Version = Mid(str, 1, instr(str, " ")-1)
' normal Ie
else
Browser = "IE"
str = Mid(UserAgent, instr(UserAgent, "MSIE")+4)
Version = Mid(str, 1, instr(str, ";")-1)
end if
else
Version = CInt(Mid(UserAgent, instr(UserAgent, "/") +
1, 1))
if Version >= 5 then
Browser = "NS6"
else
if Version >= 4 then
if instr(UserAgent, "PPC") then
Browser = "NSMAC"
else
Browser = "NSPC"
end if
else
Browser = "NS3"
end if
end if
end if
End Sub
-------------------------------------------