|
-
Apr 22nd, 2008, 10:39 AM
#1
Thread Starter
New Member
axwebbrowser and custom user agent
Hi all,
I currently have an axwebbrowser component and i am trying to navigate to a website but sending a custom User-Agent in the http headers, Ive tried:
Code:
test = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6)
Gecko/20070725 Firefox/2.0.0.6"
AxWebBrowser1.Navigate("http://blarblar.com", "", "", "", test)
However this doesnt work, and if i check the web logs, the user agent is just the same.
Any ideas?
Thanks
-
Apr 22nd, 2008, 10:54 AM
#2
Re: axwebbrowser and custom user agent
How is the webserver supposed to know what all that data in your test variable even is? headers work with a "HeaderName: HeaderValue" type syntax
So if you want to override the useragent, you need to specify your string is infact a user agent string. This will allow the override to occur, and the browser control should NOT pass its default useragent string.
Code:
test = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6)
Gecko/20070725 Firefox/2.0.0.6"
AxWebBrowser1.Navigate("http://blarblar.com", "", "", "", test)
-
Apr 22nd, 2008, 11:16 AM
#3
Thread Starter
New Member
Re: axwebbrowser and custom user agent
Man im so stupid, I should have know this!! thanks very much pal, that worked great.
One more thing though, I checked the logs, and when i viewed the index.html of my test page it worked with the custom user agent, however when it fetched 1 of the css pages it used the default user agent. any way round this?
-
Apr 22nd, 2008, 11:22 AM
#4
Re: axwebbrowser and custom user agent
Why are you using custom user agent strings? I can understand wanting to differentiate your web browser from others but you're using the IE engine so any site looking for the IE engine may not recognize your browser and display a broken page.
If you're going to mimic the user string for Firefox (which will probably break many pages that use IE hacks) then maybe you should look into incorporating the Gecko engine in your browser rather than the IE engine.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|