Exit

[Solved] Smartphone IE browser emulation

8 posts in this topic

#1 ·  Posted (edited)

[Problem solved. See post #7 ]

I have written a script for SEO (Search engine optimizing). It is running fine on desktop.

Now I would like to emulate a smartphone on the google search page.

How to tell IE to use the screen size of a smartphone?

Didn't found a solution in IE.AU3

Any advice?

TIA Exit

 

Edited by Exit
Prolem solved

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites



I'm not sure what you mean.

 

If you mean to tell to a webpage that you're from a smartphone you can do it changing your User Agent to Phone's one.

 

Saludos

Share this post


Link to post
Share on other sites

@Danyfirex   Yes, I want to do that. How to change User Agent to a smartphone?

I found a method by using F12 (developers tool), but there must be a more programatical way.


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

You can do this.

#include <IE.au3>

Local $oIE = _IECreate()
Sleep(1000)
$oIE.Navigate2("http://www.useragentstring.com/", Default, Default, Default, _
"User-Agent: Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537")

Saludos

1 person likes this

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

HttpSetUserAgent("MyUserAgent")

Wouldn't using this be simpler?

Edited by Blue_Drache
1 person likes this

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Many thanks to Danyfirex  and Blue_Drache

It gave me a pointer to dig further.

I want to emulate a  4" screen (800x400).
This is possible when using F12 and click on resolution.

See this screenshot:

Zwischenablage01.jpg


How to achive this sizing with UserAgent ?


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

OK, I got a solution:

#include <IE.au3>
$oIE = _IECreate()
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "", "{F12}")
Sleep(1000)
ControlSend("[Class:F12FrameWindow]", "", "", "^{F7}{TAB 3}{down}{TAB 3}{up 9}{down}")
_IENavigate($oIE, "http://www.google.com/#num=100&q=autoit+jon")
WinActivate($hIE)
MsgBox(262144, Default, "click 'OK' to close IE Test window", 0)
_IEQuit($oIE)

 

1 person likes this

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

Solution was not working.

Ctrl+F7 was wrong. Should be Ctrl+7

Here the correct script:

;
; Switch IE Browser to mobile and back.

#include <IE.au3>
$oIE = _IECreate()
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "", "{F12}")
Sleep(1000)
ControlSend("[Class:F12FrameWindow]", "", "", "^7")
ControlSend("[Class:F12FrameWindow]", "", "", "{TAB 3}{down}{TAB 3}{up 9}{down}")
_IENavigate($oIE, "http://www.google.com/#num=100&q=autoit+jon")
WinActivate($hIE)
MsgBox(262144, Default, "click 'OK' to return to desktop mode", 0)
WinClose("[Class:F12FrameWindow]")
MsgBox(262144, Default, "click 'OK' to close IE Test window", 0)
_IEQuit($oIE)

 


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

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