Skip to content
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

Closed
DartBot opened this issue Apr 27, 2014 · 19 comments
Closed

Dartium abuses the User-Agent header to advertise DartVM support #18463

DartBot opened this issue Apr 27, 2014 · 19 comments
Assignees
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue P1 A high priority bug; for example, a single project is unusable or has many test failures
Milestone

Comments

@DartBot
Copy link

DartBot commented Apr 27, 2014

This issue was originally filed by abarth@chromium.org


What steps will reproduce the problem?

  1. Visit https://code.google.com/p/dart/source/browse/trunk/dart/pkg/browser/lib/dart.js
  2. Notice the check for "(Dart)" in the User-Agent:

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.

@kevmoo
Copy link
Member

kevmoo commented Apr 27, 2014

Added Area-Pkg, Triaged labels.

@kevmoo
Copy link
Member

kevmoo commented Apr 27, 2014

Removed Area-Pkg label.
Added Area-Dartium label.

@dgrove
Copy link
Contributor

dgrove commented Apr 28, 2014

Set owner to @vsmenon.

@DartBot
Copy link
Author

DartBot commented Jul 3, 2014

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.

@vsmenon
Copy link
Member

vsmenon commented Jul 4, 2014

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.

@vsmenon
Copy link
Member

vsmenon commented Jul 4, 2014

Filed this for feature detection: https://code.google.com/p/dart/issues/detail?id=19832

@DartBot
Copy link
Author

DartBot commented Jul 4, 2014

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?

@DartBot
Copy link
Author

DartBot commented Jul 4, 2014

This comment was originally written by @si-robertson


foolproof

Sorry, I had to correct that.

@DartBot
Copy link
Author

DartBot commented Jul 9, 2014

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

@sethladd
Copy link
Contributor

+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.

@sethladd
Copy link
Contributor

sethladd commented Aug 6, 2014

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-Unassigned label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented Aug 6, 2014

Removed Priority-Medium label.
Added Priority-High label.

@vsmenon
Copy link
Member

vsmenon commented Aug 6, 2014

Bumping to 1.7 - we have a separate bug filed for getting mobile emulation working in 1.6: 19971


Removed this from the 1.6 milestone.
Added this to the 1.7 milestone.

@dgrove
Copy link
Contributor

dgrove commented Sep 23, 2014

Is this happening for 1.7 ?

@vsmenon
Copy link
Member

vsmenon commented Sep 26, 2014

Removed this from the 1.7 milestone.
Added this to the 1.8 milestone.

@vsmenon
Copy link
Member

vsmenon commented Oct 15, 2014

Removed this from the 1.8 milestone.

@kasperl
Copy link

kasperl commented Nov 28, 2014

Added this to the 1.9 milestone.

@kasperl
Copy link

kasperl commented Nov 28, 2014

Added Accepted label.

@vsmenon
Copy link
Member

vsmenon commented Feb 17, 2015

Removed this from the 1.9 milestone.
Added this to the 1.10 milestone.

@DartBot DartBot added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures closed-not-planned Closed as we don't intend to take action on the reported issue labels Feb 17, 2015
@DartBot DartBot added this to the 1.10 milestone Feb 17, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

6 participants