Subject: | An error in Opera |
A small test script I wrote did not work in Opera. This is what JavaScript console showed:
Event thread: click
Error:
name: TypeError
message: Statement on line 88: Type mismatch (usually a non-object value used where an object is required)
The cause of problem are these 2 lines of code in Ajax.pm:
r.setRequestHeader('Cache-Control','no-cache');
and
r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
because Opera (and I used 8.0) does not support a method setRequestHeader. So you should check for this method's support before calling it, like this:
if (r.setRequestHeader)
r.setRequestHeader('Cache-Control','no-cache');