Modify ↓
Ticket #10226 (closed enhancement: duplicate)
$.browser
| Reported by: | godligift@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | support | Version: | 1.6.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
You are getting answer #10210. But in it's answer, don't relesation is my problem.
Take posible. I'm testing in IE
alert($.browser.msie);
giving - true.
alert($.browser.opera);
in browser IE giving "unindeferent". Is resault logical structure for one's browser. Testing ro 1.6.3 and testing 1.4.2
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

In your original ticket, you mentioned that the output you were getting when alerting $.browser.msie and $.browser.opera was a value of 'undefined'.
If you test this ( http://jsfiddle.net/ZupAr/) in Opera, you'll find that msie returns 'undefined' and if you test it in Firefox you'll find that both values return undefined.
This is expected behaviour. We *expect* IE to return a value of undefined against a UA test for Opera through $.browser. To use $.browser correctly, all you need to do is check against a particular value expected as follows:
if($.browser.msie){ //returns true if IE, undefined if not (ie. not true/false) //do something }else{ //not in IE, do something else }the same could be said for any other browser. Test against the value you know will return positive when used with a specific browser and then just fallback on the 'else' is the value isn't true.
I notice that this is an enhancement request. Because we've been returning a value of undefined for quite some time and the plans are to deprecate $.browser and move it into its own plugin in the future, I don't think it makes sense for this behaviour to be altered. We may however document further what is returned to avoid future confusion.