Windows Phone open url in desktop version - windows-phone-7

I'm using this code to open url in my app
var task = new WebBrowserTask();
task.Uri = new Uri(Link, UriKind.Absolute);
task.Show();
now I have requirement to open this page in desktop version. How can I do that?
In iOS I set user agent, but there's no such param for browsertask on WP.

That is not possible by any means. System settings (in this case Internet Explorer settings) cannot be changed by your application.
If you are the owner of the website, you can specify some special query parameter that will force desktop mode. If this is a general purpose app, you might as well forget about it.

This can do it !
public void MyBrowser()
{
webBrowser1.Navigate(new Uri("http://www.stackoverflow.com"), null, "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; XBLWP7; ZuneWP7)");
}

Related

VBScript Spoof iPhone Mobile User Agent in IE

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
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.
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

Detect if Chrome Frame BHO is enabled

I have the following code to detect to see if CF BHO is enabled, but unfortunately it didn't work out, it alway returns "automation server failed to create obj"
var activexGoogleFrameBho = new ActiveXObject('ChromeFrame.Bho');
if (activexGoogleFrameBho) {
...
}
My user agent and page header are as following:
mozilla/4.0(compatible; msie 8.0; windows nt 6.1; wow64; trident/4.0;
chromeframe/32.0.1700.107; slcc2; .net clr 2.0.50727; .net4.0c; .net4.0e)
<meta http-equiv='X-UA-Compatible' content='IE=Edge,chrome=IE8'/>
any ideas?
Thanks,
I'm not sure if you can detect the helper object itself though to see if the current page is loaded in chromeframe you can check if window.externalHost exists.
http://www.chromium.org/developers/how-tos/chrome-frame-getting-started/understanding-chrome-frame-user-agent#TOC-From-the-script-on-the-web-page

i want to view something in the internet, how can i do it?

i want to view something in the internet, how can i do it?
Thanks
If all else fails, route your WLAN over a box on which you install a network sniffer. Dump the HTTP traffic. That's the last resort solution, but for sure works.
Generally user agent sniffing is the only method used to detect iPhones. You can use the develop menu in Safari to change your user agent string. An example iPhone user agent string is
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5
Alternatively, you can add a bookmarklet by Shaun Inman to Mobile Safari that allows you to view source code on your device (or just visit the page directly).

Bring back mobile version of website in WebBrowser control for wp7?

Is it possible to bring back web pages in a mobile format, if available, before showing the normal rendering of a web page? I noticed I was getting both when I used it. Or is this enabled by default?
EDIT: For example in ie on the phone you can request to recieve webpages in a mobile version or desktop version. Is this option available to developers and if not what is the default for the control?
Sadly, there's no API for toggling this setting - and no easy way to intercept the outgoing HTTP calls from the browser control.
Looking at some output from the emulator it looks like the mobile/full setting toggles this in the User-Agent:
Mobile -
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
Desktop -
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1;+XBLWP7;+ZuneWP7)
Here also are some mobile agents captured "in the wild" - http://www.elucidsoft.com/blog/2010/11/19/windows-phone-7-user-agents/
It looks like this settings is a global setting for the OS - so whatever the user chooses in the browser settings is also used in your app (I think this is what I just saw).
I had this problem for a very, very long time and I finally figured it out with the following:
string header =
"User-Agent:Mozilla/5.0 (iPhone; U;
CPU iPhone OS 4_1 like Mac OS X;
en-us) AppleWebKit/532.9 (KHTML, like
Gecko) Version/4.0.5 Mobile/8B117
Safari/6531.22.7";
MyWebBrowser.Navigate(new
Uri("http://www.google.com"), null,
header);
The following header DID NOT work for me (on the gmail website):
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
The WebBrowser control does not expose an API that enables you to choose between the Desktop or the Mobile version of a web page. You could use Fiddler to trap the traffic for outgoing requests (from the emulator or a device) to see if there's anything in particular about the request that you might be able to replicate in yoru own requests.

How can I get the actual culture name from an iPhone web app?

CLARIFIED: This is a JavaScript Web Application not a Native Object-C application.
I have a web application running on the iPhone that I need to globalize.
I've configured Settings->General->International->Region Format to "United Kingdon" and left Language as "English".
Upon inspection of the User Agent string I'm seeing the following:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/8A293
I would expect to en-GB but I'm seeing en-us.
I've even tried restarting the iPhone and it remains en-us.
From what I understand, the language portion comes from set type of your iPhone's "Language" (e.g. menus and buttons in the user interface) and not the Region Format.
source
I believe you should use NSUserDefaults to get that information
ChoosingLocalizations
It would appear as if the iPhone browser does not look at the region being set by the settings on the device.
The user agent and navigator.language both return en-US and disregard any changes to the region by the user.

Resources