Skip to content

Instantly share code, notes, and snippets.

@pegli
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pegli/fbf4d0837cbbefb69db7 to your computer and use it in GitHub Desktop.
Save pegli/fbf4d0837cbbefb69db7 to your computer and use it in GitHub Desktop.
Alloy WebView example
$.win.open();
function webviewLoad() {
alert("loaded");
}
function loadGoogle() {
$.webview.url = "http://google.com/";
}
function loadAmazon() {
$.webview.url = "http://amazon.com/";
}
<Alloy>
<Window id="win">
<WebView id="webview" top="24" onLoad="webviewLoad"/>
<Toolbar bottom="0">
<Items>
<Button title="Google" onClick="loadGoogle"/>
<Button title="Amazon" onClick="loadAmazon"/>
</Items>
</Toolbar>
</Window>
</Alloy>
$.win.open();
function webviewLoad() {
alert("loaded");
}
function openChild() {
var view = Alloy.createController('child').getView();
view.open();
$.win.close();
}
<Alloy>
<Window id="win">
<WebView id="webview" url="http://yahoo.com/"/>
<Toolbar bottom="0">
<Items>
<Button title="Open Child" onClick="openChild"/>
</Items>
</Toolbar>
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment