Sign in to follow this  
Followers 0
Ranger08

Change User Agent in IE?

6 posts in this topic

#1 ·  Posted (edited)

My goal is to change the user agent for internet explorer to something else (for the whole process/session and not just one page). Been searching and haven't found a clear answer as to how to do this, if anyone can give me a little helping hand I'd appreciate it, thanks.

Tried, but didn't work out well for me (can't say I really understood it in the first place though):

Code I'm working with

#include <IE.au3>
$URL = "http://google.com"
$URL2 = "http://youtube.com"
$OIE = _IECREATE("http://msn.com")
_IENAVIGATE($OIE, $URL, $URL2)
Edited by Ranger08

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try doing it like this.

Local $sUserAgent = "Agent User 1.0"
Local $skey = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings"
If @OSArch <> "X86" And @AutoItX64 Then $skey = "HKEY_CURRENT_USER64SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
Local $Write = RegWrite($skey, "User Agent", "REG_SZ", $sUserAgent)
If Not $Write Then Exit MsgBox(16, "Error!", "Something went wrong while trying to set the useragent.")
DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

Edit: Do not run the first one, I remembered the data type of that key, this one is correct.

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for the reply, didn't work for me, here's the exact code i used

#include <IE.au3>
$URL = "http://google.com"
$URL2 = "http://youtube.com"
$OIE = _IECREATE("http://whatsmyuseragent.com")
Local $sUserAgent = "Agent User 1.0"
Local $skey = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings"
If @OSArch <> "X86" And @AutoItX64 Then $skey = "HKEY_CURRENT_USER64SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
Local $Write = RegWrite($skey, "User Agent", "REG_SZ", $sUserAgent)
If Not $Write Then Exit MsgBox(16, "Error!", "Something went wrong while trying to set the useragent.")
DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
_IENAVIGATE($OIE, $URL, $URL2)
Edited by Ranger08

Share this post


Link to post
Share on other sites

#include <IE.au3>
Local $URL = "http://google.com"
Local $URL2 = "http://youtube.com"
Local $sUserAgent = "Agent User 1.0"
Local $skey = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings"
If @OSArch <> "X86" And @AutoItX64 Then $skey = "HKEY_CURRENT_USER64SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
Local $Write = RegWrite($skey, "User Agent", "REG_SZ", $sUserAgent)
If Not $Write Then Exit MsgBox(16, "Error!", "Something went wrong while trying to set the useragent.")
DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
$OIE = _IECREATE("http://whatsmyuseragent.com")
Sleep (500000)
_IENAVIGATE($OIE, $URL, 1)

Now?


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks

Checked regedit and saw that the change was applied to the user agent, don't know why none of the sites I use to check the user agent aren't showing the change. Tried flushing DNS/Cache, same result. Could there possibly be an alternative way?

Edited by Ranger08

Share this post


Link to post
Share on other sites

Maybe look into IEs settings, it must not be using system proxy settings.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0