Is it possible to set a defined user agent to an iFrame? If yes how?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is not possible since the browsers have fixed user agent strings that they send with all request regardless of whether its from an iframe or not. And this is not something modifiable via JS.
You can however, have a script on your server which spoofs the user agent string (via curl for example) and then have your iframe call that script which in turn fetches the page you want called with a different user agent string and returns the output back to your iframe. For example:
http://yourserver.com/yourproxy?url=<http://url-to-fetch/page>&ua=<user-agent-string-to-use>