Can any one please let me know how to open child browser using titanium for IOS.
I have used, Titanium.Platform.openURL(url); but it is opening out of the application and can't come back to our app after closing the window/tab.Any ideas?
Thanks in Advance,
Swathi
You can use a WebView for that. Have a look at the API:
http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView
there is an example how to use it.
I think what you're looking for is a SafariDialog described here:
http://docs.appcelerator.com/platform/latest/#!/api/Modules.SafariDialog
Add the module like so:
<ti:app>
...
<modules>
<module platform="iphone">ti.safaridialog</module>
</modules>
...
</ti:app>
And use it like so:
var dialog = require('ti.safaridialog');
if (dialog.isSupported()) {
dialog.open({
url: 'http://appcelerator.com',
title: 'Titanium rocks!',
tintColor: 'red'
});
}
This also adds the "Done" button you were looking for.
Related
I have this website https://www.storytel.com/sg/en/where I am trying to click on the button (refer to the image) in the Subscription Component which resides in the Shadowroot. I have tried with the following codes but it didn't work. It will be great if someone can help. Thanks in advance.
test('Click inside shadowDOM', async t => {
const shadowBtn = Selector(() => document.querySelector('storytel-subscription').shadowRoot.querySelectorAll('*[data-testid="subscription-card-0-button"]'));
await t
.click(shadowBtn);
});
There seems to be a bug with processing elements in shadow dom. I suggest you create an issue in the TestCafe GitHub repository and describe your scenario there: https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md
I make the setup as given in the documentation and always get the following error message: "Error: Requested module not found: android.app.Activity", how to solve this ?
function doClick(e) {
alert($.label.text);
}
var Activity = require('android.app.Activity');
var ac = new Activity();
$.index.open();
If you're working with LiveView - disable LiveView and clean your project. That was the case for me on Android.
I'm using this code to get the Android activities (i.e. open, pause, resume, stop etc..):
var activity = Ti.Android.currentActivity;
But in your situation, you probably need to use this:
var Activity = require('android.app.Activity');
var ac = new Activity(Ti.Android.currentActivity)
Make sure hyperloop module is available in your tiapp.xml file modules section.
<modules>
<module platform="android">hyperloop</module>
<module platform="iphone">hyperloop</module>
</modules>
Please see the following doc links
- http://docs.appcelerator.com/platform/latest/#!/guide/Enabling_Hyperloop
- http://docs.appcelerator.com/platform/latest/#!/guide/Hyperloop_Guides
Hope this helps.
Im loading an external page with InAppBrowser and it seems like neither loadstart nor loadstop are been fired on Android. My code:
var ref = window.open(url, '_blank', 'location=yes;');
ref.addEventListener('loadstart', function() {
console.log('loadstart!');
console.log(event.url);
});
A couple of checks should fix it for you.
Make sure you load the right cordova-2.x.x.js file
// Platform: android
Include the InAppBrowser plugin in res/xml/config.xml
<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser" />
Write the correct white-list tag (differs from iOS)
<access origin="https://domain.com" subdomains="true" />
You really have to include onDeviceReady like in the example files, that did the trick for me.
document.addEventListener('deviceready', app.onDeviceReady, false);
I'm really stuck with an issue. I would like to download a PDF/ZIP formatted file from webview but I can't find any solution/tutorial on the internet, I tried to look webview property class.
i have a webview:
WebView x:Name="webviewIntranet" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
and my method:
public IntranetPage()
{
webviewIntranet.Navigate(new Uri("http://www.testme.com"));
this.InitializeComponent();
}
I'm able to show the webpage content but nothing happens when a try to download/click to download some files.
First of all some reading about what's new in WebView control
http://blogs.windows.com/windows/b/appbuilder/archive/2013/07/17/what-s-new-in-webview-in-windows-8-1.aspx
as you can see, WebView hanldes different browser events:
It doesn't support showing nothing else than webpages, but WebView.UnviewableContentIdentified event is fired for them
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.unviewablecontentidentified.aspx
Then you can use file association to throw it to the OS (or do what you need with the file throught the uri... i hope)
void webView1_UnviewableContentIdentified(WebView sender,
WebViewUnviewableContentIdentifiedEventArgs args)
{
Windows.Foundation.IAsyncOperation<bool> b =
Windows.System.Launcher.LaunchUriAsync(args.Uri);
}
WebView can't download file. Microsoft has tried not to be WebView, a replacement of IE browser. See the answer from MSDN forum.
I think you can do this, but there's quite a bit of manual intervention. Using something like the BackgroundDownloader you can download a file that you have the URI for. Is you want to also intercept web view navigation, then there's a few workarounds for that; for example: here
Is there an option in DOJO where files can be uploaded by Drag and Drop from desktop to the browser?
No I dont believe so. As outlined here and here its not really possible to do without using a plugin.
Old post, but still one of those posts being found by google easily. For those interested how to do this:
Have a look at this SO answer
Dojo overview of how to use its Uploader (styled as a button)
Use addDropTarget to link a dropArea for that uploader (for HTML5-enabled browsers -- see also first link))
To make the drop target visibly react to drag events, I had to connect directly to browser events like ondragenter or ondragleave (see code snippet below)
createUploader: function() {
// ... define uploader and droptarget
d_on(this.dropArea, "dragover", d_lang.hitch(this, this.dropAreaOver));
d_on(this.dropArea, "dragleave", d_lang.hitch(this, this.dropAreaLeave));
d_on(this.dropArea, "drop", d_lang.hitch(this, this.dropAreaLeave));
}
dropAreaOver: function(evt) {
evt.preventDefault();
domClass.add(this.dropArea, "dropAreaOver");
},
dropAreaLeave: function(evt) {
evt.preventDefault();
domClass.remove(this.dropArea, "dropAreaOver");
}