Reputation: 1269
In gwtproject it says if you use browser-sensitive code, then you must use user.agent set property. So what is browser-sensitive code exactly?
Upvotes: 1
Views: 101
Reputation: 9741
browser-sensitive code
means a piece of code which is different for each browser implementation.
In GWT you can mark these pieces of code, and make that only the appropriate portion of code per each browser is included in its permutation, making the compiled code smaller (not including unnecessary code) and faster (not having to evaluate browser conditions)
In traditional javascript libraries like jQuery, they have their code plenty of blocks like:
if (jquery.browser.isie) {
// lines to be executed only in IE
} else {
// lines to be executed only in non IE
}
As you see, these libraries include the code for all browsers, even though each browser executes just its specific block.
Note that the way GWT has for doing it is using a technique called deferred-binding.
Upvotes: 2