[prev in list] [next in list] [prev in thread] [next in thread] 

List:       konq-bugs
Subject:    [Bug 278618] Obviously the canvas 2D rendering context method
From:       Gérard Talbot <browserbugs () gtalbot ! org>
Date:       2011-08-31 2:49:47
Message-ID: E1Qyas7-0001tc-Dv () bugs ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=278618





--- Comment #13 from Gérard Talbot <browserbugs gtalbot org>  2011-08-31 02:49:47 \
--- The component for this bug report is wrong: it's not kjs, it should be khtml.
I'm sure of this. The javascript error we all got is correct; the javascript
engine is correct and doing the right thing.

> By the way, there is no possibility to know in advance which browser a
> visitor of my page uses.

You should not use browser sniffing or string detection of user.agent string
for many reasons (often unreliable, often unmaintainable, often wrong). You
should first and foremost test, verify, check browser capabilities and test,
verify, check browser support for object methods. This is what the FAQ suggests
too (albeit it could be better edited):

As an author of a web site, how can I identify Konqueror from other browsers?
http://www.konqueror.org/faq/#AsanauthorofawebsitehowcanIidentifyKonquerorfromotherbrowsers


"
We are working very hard on making all the differences go away thus making any
differentiation impossible - or rather needless. 
 In case you experience a bug or missing feature in Konqueror (let's say the
JavaScript function document.foo() is not working as expected) we recommend to
test for features rather than the browsers brand. 
"

In your case, a good working, reliable code fork based on browser capability
would be:

if(typeof ctxt.fillText == "function") // supported
  {

  }
else // not supported
  {

  };

More reading:

A Strategy That Works: Object/Feature Detecting by comp.lang.javascript
newsgroup FAQ notes
http://jibbering.com/faq/faq_notes/not_browser_detect.html#bdFD
or
http://web.archive.org/web/20090623121253/http://www.jibbering.com/faq/faq_notes/not_browser_detect.html#bdFD


Using Object/Feature support detection approach
https://developer.mozilla.org/index.php?title=En/Using_Web_Standards_in_your_Web_Pages \
/Developing_Cross_Browser%2F%2FCross_Platform_Pages#Using_Object.2FFeature_support_detection_approach:_best_and_overall_most_reliable


Browser detection - No; Object detection - Yes
http://www.quirksmode.org/js/support.html

regards, Gérard

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Konq-bugs mailing list
Konq-bugs@kde.org
https://mail.kde.org/mailman/listinfo/konq-bugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic