Load Url in Web View Intel Xdk - intel-xdk

I want to convert my website to mobile application with Intel XDK. So , how to do this with web view.I want to load the URL on the current web view not open it on a new page with the native browser.

Easy way is to use window.location= to load URL:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no">
<script src="cordova.js"></script>
</head>
<body>
<script>
window.location = "http://www.yourwebsite.com";
</script>
</body>
</html>
Better way is to use InAppBrowser and connection Cordova plugins to load website, so that you can handle connection loss and reload, it will load complete website in background and then display, here is code: https://github.com/krisrak/html5-cordova-webapp

Related

Tableau Web Data Connector hosted in a Cloud Platform getting stuck in infinite loop

I have this TWDC(tableau web data connector) app hosted on our company's private cloud.
Every app that are deployed there are accessed after the user logs in via a Single Sign On login page, then redirected to the app.
When I try to use my web data connector on my Tableau Desktop it gets stuck on an infinite loop, after i push the button which does tableau.submit().
I've set the debugger and found out, that when I push the button, the page that is loaded is not the index.html of my WDC but the redirect page from the SSO login.
I have no idea why is this happening, doesn't make much sense, because it loaded the index.html in the first place, but after i push this button it gets back to somewhere in the middle of SSO login and redirect page.
Just a note: It works fine on the simulator.
Any thougths on this?
Here's my code:
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TableauAngular</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/tableauwdc-2.3.latest.js"></script>
<script type="text/javascript" src="controller.js"></script>
</head>
<body>
<button id="submitButton">Send</button>
<br />
<br />
<textarea id="log" style="border: 1px solid #000; width: 100%; height: 700px;"></textarea>
<br />
<div id="placeholder"></div>
</body>
</html>
JavaScript
$(document).ready(function() {
try {
$("#submitButton").click(function() { tableau.submit() });
var myConnector = tableau.makeConnector();
// these are function which are not important for this question;
myConnector.getSchema = fnGetSchema;
myConnector.getData = fnGetData;
tableau.registerConnector(myConnector);
} catch (e) {
logger("ERROR: " + JSON.stringify(e));
}
});
This isn't a problem with your code. With the WDC there is an interactive phase where the user is shown a screen and can interact (this is your first SSO sign-in) but then there is a non-interactive (Get Data) phase where Tableau will try to retrieve the data and never shows the SSO login to the user. See docs. Given this page is loaded without user interaction it can't/shouldn't have SSO security on it.

VSCode extensions: How do I open a new pane with an http url

In VSCode, is it possible to open a new pane pointing to an http url? I have a server running locally (on port 8080). I want to open it as a WebView. I couldn't find anything that provides this in the WebView API docs.
The functionality I'm looking for is similar to the snippet, except with the url opening in the VSCode editor iteself.
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('http://locahost:8080'));
You can achieve by using an iframe within webview https://code.visualstudio.com/docs/extensions/webview
// And set its HTML content
panel.webview.html =
`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cat Coding</title>
</head>
<body>
<iframe width="100%" height="100%" src='http://locahost:8080'> </iframe>
</body>
</html>`;

Azure media player(AMP) not working on chrome if script file is saved locally

I have saved the source of sample AMP video http://amp.azure.net/libs/amp/latest/samples/dynamic_setsource.html locally and trying to play video. It works in IE and Edge but not in chrome. if i host this file it works.
Can you please help me understand what is wrong here?
You can try running script in IE an Chrome to see the difference.
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Skill Cloud</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://amp.azure.net/libs/amp/1.7.1/skins/amp-default/azuremediaplayer.min.css" rel="stylesheet">
<script src="http://amp.azure.net/libs/amp/1.7.1/azuremediaplayer.min.js"></script>
</head>
<body>
<h1>Skill Cloud</h1>
<video id="azuremediaplayer" class="azuremediaplayer amp-default-skin amp-big-play-centered" tabindex="0"> </video>
<script>
var myOptions = {
autoplay: true,
controls: true,
width: "100%",
height: "auto",
poster: ""
};
var myPlayer = amp("azuremediaplayer", myOptions);
myPlayer.src([{ src: "http://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest", type: "application/vnd.ms-sstr+xml" }, ]);
</script>
<footer>
<br />
<p>© Microsoft Corporation 2016</p>
</footer>
</body>
</html>
Thanks
When you run the code locally, Chrome opens your index.html with the file:// protocol. Due to Chrome's security policy local resources aren't allowed to be loaded and that's what's preventing playback. (If you check out your JavaScript console, I bet you'll see a similar error.)
To workaround this, you can use an IDE like Visual Studio or WebMatrix that will automatically set up a local web server for you so you can access your page with http://localhost:8000 or whichever port you prefer.
If you don't want to use VS or WebMatrix, you could also use Python's Simple HTTP server. Hope this helps and happy coding :)

Can not show video (mp4 format) when developing a web app for samsung smart TV

I'm using the latest Samsung smart TV simulator and developing a very simple app for it: Play a video.
The code is show as below. The code is so simple that I can not find the root cause (can not play video). I verified it on mac safari and chrome web browser.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>basicexample</title>
</head>
<body background="http://icbd.tv/wp-content/uploads/2012/06/background.jpg">
<video id="video" src="http://www.808.dk/pics/video/gizmo.mp4" autoplay="autoplay">Your browser does not support the video tag.
</video>
</body>
</html>
Samsung SDK does not support autoplay attribute. To play video you need to manualy start it:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>basicexample</title>
</head>
<body onload="document.getElementById('video').play(1)" background="http://icbd.tv/wp-content/uploads/2012/06/background.jpg" >
<video id="video" src="http://www.808.dk/pics/video/gizmo.mp4" autoplay="autoplay">Your browser does not support the video tag.</video>
</body>
</html>
This code plays video on 2011-2013 Emulators. 2010 does not support <video> tag.

Launching Custom URL in PhoneGap + iPhone

I am developing Sencha touch application that will work on iPhone. Now application is ready and works fine in phone browser. But, now I want to distribute my application so I am using PhoneGap.
All my HTML and JavaScript pages are deployed at http://170.60.26.20:8099/Sencha/Html/index.html. Now i want to load that URL using phonegap. Suggest me the steps how could I do this.
I have installed phonegap-1.2.0-0 version.
Create new Phonegap App in xcode and you just need to modify already exist index.html file in www folder.
You can use window.location javascript method to load your web app in phone app.
In PhoneGap(Cordova).plist, add your server to the ExternalHosts list and make OpenAllWhitelistURLsInWebView to YES.
Please try following code to run your html pages in phonegap app.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- Change this if you want to allow scaling -->
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>LoadUrl
<!-- If you application is targeting iOS BEFORE 4.0 you MUST put json2.js from http://www.JSON.org/json2.js into your www directory and include it here -->
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
function onBodyLoad()
{
document.addEventListener("deviceready",onDeviceReady,false);
}
/* When this function is called, PhoneGap has been initialized and is ready to roll */
function onDeviceReady()
{
// do your thing!
window.location="http://web.me.com/djpinter1/iPhone/jqtouch/demos/main_tabbar/#ui";
//window.location="http://170.60.26.20:8099/Sencha/Html/index.html";
}
</script>
</head>
<body onload="onBodyLoad()">
</body>
</html>
In your xcode , start a new project as phonegap project. Then copy the files from your project folder to www folder in the phonegap project.Keep in mind that index.html file should be in the parent folder , otherwise you have to change the url accordingly in the corresponding class that invokes a webview.
You can follow this link
http://wiki.phonegap.com/w/page/39991939/Getting%20Started%20with%20PhoneGap%20iOS%20using%20Xcode%204
Hope it will help