SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    $books++ == true matsko's Avatar
    Join Date
    Sep 2004
    Location
    Toronto
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding an extra HTTP Header in AJAX

    If I was to add my own custom header into an AJAX call, then would that break browser compatibility/security?

    Here's a pseudocode example:

    var ajax = new AjaxCall;
    ajax.addHeader('my-website-ajax','1');
    ajax.url = '...';
    ajax.send();

    Since the header is custom, and doesn't exist in any specification whatsoever, then would this still be valid?

    Are Headers that are prefixed with a "X-" considered custom? Like X-Forwarded-For, X-Mailer?
    I can't believe I ate the whole thing

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by matsko View Post
    Are Headers that are prefixed with a "X-" considered custom? Like X-Forwarded-For, X-Mailer?
    Yes.

    btw, jquery sends
    X-Requested-With: XMLHttpRequest


    But, sometimes I wonder if a query string param is really more appropriate.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •