1

This code fetches the HTML source of http://www.foo-example-site.com/(index.html)

$.ajax({ url: 'http://www.foo-example-site.com', success: function(data) {
    alert(data); 
    } 
}); 

However, the website changes the content of HTML source depending on User Agent.
If I want to switch User Agent to this below only when using ajax request, how can I fix my code?

Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16
BenMorel
  • 34,448
  • 50
  • 182
  • 322
cat
  • 749
  • 10
  • 22

1 Answers1

2

No, this is part of the HTTP protocol. You can change it in the browser, but not in an AJAX call.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176