Encapsulating a web page inside a C#/XAML Metro app - xaml

In the msdn docs it says in an HTML/CSS/JS Metro app an iFrame can be added to the page and website content can be loaded from a 'web context'
I would prefer to work in C#/XAML for this Metro app and I would just like it to encapsulate a website.
What is the correct method for displaying a website within a XAML page? Is there an equivalent of an iFrame in XAML? Can it be made full screen?

You can use the WebView class to display HTML content in a XAML app.

Related

Windows 8 app load web app from url

I've developed an Android app who loads a web app from an url in fullscreen and caches it with application cache. That works fine, so I would do the same for Windows 8. Is this possible? How it's done?
To load any WebSite/WebApp in your windows-8 app, you can add WebView control in your ApplicationPage.
You can find more details/Information regarding WebView control here
and find Code samples for Adding WebView in your app here
For detailed answer, you have to elaborate your question more.

IBM Worklight - How to hide the HTML page in a Hybrid app and load native page instead?

I am developing a hybrid app and my first page is native page in both android and ios. I kept initial html page as blank white background and loading native page by using the WL.nativePage.show API method.
I am able to go to native page but after the splash screen, it's showing a white screen which is my HTML page for a while then the native pages is displayed. So I want to avoid that white screen. How to do that?
My code for showing native is:
function wlCommonInit() {
WL.NativePage.show('ProductHomeViewController', backFromNativePage, params);
}
This is not easily doable in Worklight 6.1, but is likely to be improved in a later release.
In Android, you can change in AndroidManifest.xml the default activity the application starts with that of yours (the activity you have created for your Native Page)
In iOS, you can start another UIViewController from CDVMainViewController
The above will help to have a Hybrid app that its "start page" (the page you see after the splash image) is a native page, HOWEVER, this will not help in sharing the session between the Hybrid and Native pages (as explained in the answer to this question by you).
There is work in progress to create a Cordova plug-in that will allow session sharing between hybrid and native pages when the native page is the starting page of the application; it is not yet ready. As I wrote at the top, in a future release all of this should work better.
To address the questions in the comments:
The Hybrid application also contains that same Native API as a Native application would, this means that once you launch the app and navigate to a native page after the splash image (based on the above), you can still use the same native API methods to connect to the Worklight Server, invoke Worklight Adapters, etc.
The problem is still the sharing of the cookies (session) between the native webview and the hybrid webview.
Again, as written above, there is work in progress to create a Cordova plug-in that will allow session sharing between hybrid and native pages when the native page is the starting page of the application; it is not yet ready. In a future release all of this should work better.

Can a web browser control be embeded in a Metro XAML App with the full features of a Metro Web App?

Can you embed a IE web browser control in a C# XAML based Metro app on windows 8?
Also when doing so can the HTML/Javascript it it have the full featureset that a Windows 8 HTML app has,such as calling the WinRT apis?
There is a WebView control you can use to view websites or open html strings, but I believe to be able to communicate with the WinRT APIs you would need to relay the calls through the ScriptNotify events.

iOS App & jQuery Mobile Site - Include JS file ONLY if page is viewed in native iPhone app

I have a mobile website built using jQuery Mobile. I am currently designing an iOS native app with a single webView to display this mobile website.
PROBLEM:
If the jQuery mobile webpage is viewed in a normal mobile browser, I want all to function normally. BUT if the webpage is viewed using the webView in the iPhone app (not Safari.app) I am designing, I want to include an additional line of code on the webpage to pull in some custom JS.
Here's what I want to be added to the page ONLY IF viewed inside of my iPhone app's webView:
<script type="text/javascript" src="http://www.example.com/mobile/js/custom-jqm-defaults.js"></script>
This code needs to be pulled in (according to the jQuery mobile docs) before jQuery Mobile is loaded. Is this possible? And if so, could you point me in the right direction and give me some code?
EDIT
I found this link whereby Facebook detects if they are being viewed WITHIN an app. Is there another way to do this obviously NOT using the FB API? Here is their code:
if (FB.UA.nativeApp()) {
// Hide your credits stuff
}
You can change the user agent in your NSURLRequest, and then check for that agent on your server.
Changing it app-side is easy.

Is it Possible with out creating a webview we can view the web page

Is this possible with out using a webview we can view the web page in our view
If you dont want to build your own HTML renderer (almost rebuilding a browser) then i suppose not. My advice is to use a UIWebView or the browser installed on the device.