Closed
Bug 526209
Opened 15 years ago
Closed 8 years ago
provide a way for chrome JavaScript to change navigator.userAgent on a per-page basis
Categories
(Core Graveyard :: Embedding: APIs, enhancement)
Core Graveyard
Embedding: APIs
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: benoit, Unassigned)
References
Details
(Whiteboard: DUPEME)
To alleviate the problem of web browser discrimination from our users, I'm developing a Mozilla extension that spoofs the user agent string on a per-page basis.
Currently I have an JavaScript XPCOM component that intercepts HTTP requests and changes the User-Agent header if necessary. This works for websites that only use server-side scripting to determine what web browser is making the HTTP request. However, this doesn't work for websites that, in addition to checking HTTP requests, have JavaScript code that checks navigator.userAgent and decide based on the result what code to (not) execute. This is the case for FaceBook, for example.
However, there is currently no way for chrome JavaScript to change the navigator.userAgent object on a per-page basis. If this would be possible, then temporary spoofs of the object for websites like FaceBook would be possible.
Comment 1•15 years ago
|
||
Actually, I think navigator.userAgent for any "page" should just always match the User-Agent header sent in the HTTP request that loaded this document. That should make the spoofing solution only have one point where to set this, and would make us stay consistent.
Blocks: 387416
Comment 2•15 years ago
|
||
timeless tells me his work in bug 334875 should provide a way to do this - now we only need to drive that work forward...
Comment 3•14 years ago
|
||
window.navigator is implemented in nsGlobalWindow.cpp. I.e. that's custom JS code that's executed for every invocation (to my knowledge), and nsGlobalWindow.cpp should be able to know its URI, so I don't see why this wouldn't be possible to implement without too much trouble.
Comment 4•14 years ago
|
||
If I read the code correctly, that would sounds like it would take the user agent string itself from the HTTP channel, actually, but Benoît said that wouldn't work correctly. Interesting - but then I might misread the code, as I basically don't have a clue about C++ and might misunderstand it.
Comment 5•14 years ago
|
||
I don't think bug 334875 helps with this at all.
No longer depends on: 334875
gavin: in theory it should. if navigator is a per window object it can be subsumed by one which handles userAgent specially.
Comment 8•8 years ago
|
||
Marking a bunch of bugs in the "Embedding: APIs" component INCOMPLETE in preparation to archive that component. If I have done this incorrectly, please reopen the bugs and move them to a more correct component as we don't have "embedding" APIs any more.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•