Results 1 to 4 of 4
  1.    #1  
    Anyone know how to set this up with Ajax.Request? i've already read and attempted to put everything documented here (Prototype JavaScript framework: Ajax.Ajax.Request) but it doesn't seem to send the custom User-Agent here is the code.

    	var request = new Ajax.Request(currentURL, {
    		method: 'get',
    		evalJSON: false,
    		requestHeaders: {"User-Agent":"Mozilla 5.0 (Linux; X11)"},
    		onSuccess: this.RequestSuccess.bind(this),
    		onFailure: this.RequestFailure.bind(this)
    Also tried:
    requestHeaders: ["User-Agent":"Mozilla 5.0 (Linux; X11)"],
    requestHeaders: "User-Agent":"Mozilla 5.0(Linux; X11)",
    anyone else try this, or got it to work?
    Last edited by Phrozen; 07/24/2009 at 09:18 PM. Reason: Not sure why i typed Customer instead of Custom :(
  2. #2  
    I've tried doing the same way as you have, to no avail. I am working on getting the Pre to masquerade as an iPhone to get iPhone formatted versions of web sites. I will admit that I havent spent much time, but probably will be playing with it more over the weekend. I'll keep you up to date on what I find.
  3. #3  
    I am able to set other http header with this format

    requestHeaders: ['x-user-agent', 'JSON'],

    but not "User-Agent", it seems to be explicitly blocked. Perhaps it is getting overridden before the Ajax request is sent. Interestingly I can over ride the "Accept" http header.

    Can anyone confirm and/or explain this?
    Last edited by Shmorty; 09/08/2009 at 01:58 PM.
  4. drnull's Avatar
    570 Posts
    Global Posts
    571 Global Posts
    Forums webOS • View topic - Ajax.Request, sendHeaders?

    lmorchard explained why this is happening in the last post here. Put briefly, though, Yes, WebKit blocks us from changing the User-Agent.

Tags for this Thread

Posting Permissions