New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dartium abuses the User-Agent header to advertise DartVM support #18463
Comments
Removed Area-Pkg label. |
Set owner to @vsmenon. |
This comment was originally written by @si-robertson Yep, this definitely needs to be changed. My suggestion would be to expose a navigator.dartEnabled() function. A navigator.javaEnabled() function is already exposed in browsers so Google would have a good argument for dartEnabled() to be supported by the W3C if needed. The user agent string is completely unreliable for feature detection. |
We will remove the "Dart" in the user agent. We'd like a solution that allows server-side detection - i.e., to allow the server to send either Dart or JS based on the browser. Perhaps just testing browser versions - e.g., if Dart is enabled in Chrome 42, check for Chrome >= 42 - is sufficient. Thoughts on this welcome. Regardless, JS-side feature detection seems like a good idea. I'll file a separate bug for that. |
Filed this for feature detection: https://code.google.com/p/dart/issues/detail?id=19832 |
This comment was originally written by @si-robertson Awesome. Thanks for doing that :) I haven't thought of a server-side solution for this yet, that will be tricky without client-side feature detection. Even the Chrome >= 42 would require use of the user agent string unless I'm mistaken. One thing I have been looking at is alternative ways to load Dart|JS scripts client-side using a custom HTML element. It isn't fallproof right now but it works. The code is available at the following address if you want to take a peak. https://gist.github.com/retromodular/bdc7d975a3782b160da4 It seems like the cleanest way to deal with this client-side, so maybe you guys could consider providing an official Google JS lib that does something similar? |
This comment was originally written by @si-robertson foolproof Sorry, I had to correct that. |
This comment was originally written by druxt...@gmail.com I look for the user agent on the server side. By this way I win few ms. http://codeshare.io/MbArw |
+1 for a server-side way of detecting Dart code. This way, my server can send the appropriate script. One idea: add application/dart to the Accept: header sent by the browser. |
Bumping to 1.6. DevTools mobile emulation is broken in Dartium because we're not including the word 'Dart'. If we resolve this issue, mobile emulation will start working again. Added this to the 1.6 milestone. |
Removed Priority-Medium label. |
Is this happening for 1.7 ? |
Removed this from the 1.8 milestone. |
Added this to the 1.9 milestone. |
Added Accepted label. |
This issue was originally filed by abarth@chromium.org
What steps will reproduce the problem?
if (navigator.userAgent.indexOf('(Dart)') === -1) {
What is the expected output?
Web sites should be able to detect the presence of the DartVM without looking at the User-Agent header.
What do you see instead?
Web sites look at the User-Agent header to detect the presence of the DartVM.
What version of the product are you using? On what operating system?
HEAD version on all operating systems.
Please provide any additional information below.
The User-Agent string is an unfortunate wart of the web platform that can only increase in size and complexity. Browser vendors won't want to bloat the User-Agent header when then add support for the DartVM because the User-Agent header is included in every HTTP request for the entire web. However, as written, browser/lib/dart.js requires browsers that integrate DartVM to bloat their User-Agent header in order not to break existing content authored with Dart.
The text was updated successfully, but these errors were encountered: