VBScript Spoof iPhone Mobile User Agent in IE

点点圈 提交于 2019-12-08 13:21:40

问题


How can I spoof the user agent on demand in Internet Explorer via VBScript? There is a site I want to access that is intended for mobile only devices. My goal is to spoof an iOS mobile device. I need to be able to fake the agent, display the page, ad interact with it. Google is failing me.

TIA


回答1:


This snippet of code connects to http://www.whatsmyua.com/ pretending to be an iPhone 6 and prints the output of the site:

Dim o : Set o = CreateObject("MSXML2.XMLHTTP")
o.Open "GET", "http://www.whatsmyua.com/", False
o.SetRequestHeader "User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"
o.Send
WScript.Echo o.ResponseText

I didn't have an iPhone 6 to hand so I used this question to determine the user agent.




回答2:


Managed to piece together a working solution to my prob (example using windows phone):

set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "http://whatsmyuseragent.com",0,0,0,"User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)"

Now this solution exists on the internet. lol



来源:https://stackoverflow.com/questions/32919297/vbscript-spoof-iphone-mobile-user-agent-in-ie

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!