apache / cordova-plugin-inappbrowser Goto Github PK
View Code? Open in Web Editor NEWApache Cordova InAppBrowser Plugin
Home Page: https://cordova.apache.org/
License: Apache License 2.0
Apache Cordova InAppBrowser Plugin
Home Page: https://cordova.apache.org/
License: Apache License 2.0
For the new ios inappbrowser plugin, it uses usewkWebView to decide whether using UIWebView or WKWebView, and the default value is NO.
Assuming a cordova project currently uses UIWebView for inappbrowser plugin and cordova main webview. Later the project is upgraded to use wkwebview, usually the developers want to use wkwebview in both inappbrowser and main webview after the upgrading. In that case, the developer needs to update the project to explicitly set the browserOptions.usewkwebview in all the places when inappbrowser is opened.
This change can be avoided if the default value of browserOptions.usewebview can be decided based on the main cordova UIWebView type. So in case the caller does not explicitly set the browserOptions.usewebview value, if the main cordova UIWebView uses wkwebview, then inappbrowser can automatically set usewkwebview to true. Otherwise setting it to false.
With this approach, the project can be upgraded to use wkwebview without any change the code. While it still allows developers to explicitly set usewkwebview if the default behavior does not fit.
This approach is currently used in our cordova projects, but if this is a common issue for others, then it makes sense to have this logic implemented in inappbrowser plugin.
Thanks
Jonathan
I built an app that gathers links and opens them in the inappbrowser.
The links open in the inappbrowser and some of the links contain videos. However they do NOT play fullscreen on android.
Any help will be appreciated. Thank you.
I am using the inappbrowser to download an .apk file, but the download does not start.
I've tested the HTML page by using several mobile browser and everything works.
Any feedbacks?
Hi,
While testing the new ios inappbrowser plugin with wkwebview on iOS 12 device, when the javascript code calls injectScriptCode method, the application may hang.
The reason is in CDVWKInAppBrowser.m, the completing block of evaluateJavascrip method is not called, so the method stuck in the while (!finished) loop
_- (NSString *)evaluateJavaScript:(NSString *)script {
__block NSString resultString = nil;
__block BOOL finished = NO;
__block NSString _script = script;
NSLog(@"evaluateJavaScript: %@", script);
[self.inAppBrowserViewController.webView evaluateJavaScript:script completionHandler:^(id result, NSError *error) {
NSLog(@"evaluatejavascript result: %@, %@", result, error);
if (error == nil) {
if (result != nil) {
resultString = result;
NSLog(@"%@", resultString);
}
} else {
NSLog(@"evaluateJavaScript error : %@ : %@", error.localizedDescription, _script);
}
finished = YES;
}];
while (!finished)
{
NSLog(@"CDVWKInAppbrowser evaluateJavaScript runloop");
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
}
NSLog(@"evaluateJavaScript: %@", resultString);
return resultString;
}_
The xcode console log has the below output. After calling evaluatejavascript method, it calls runloop method few times in while block, and then just stops, the app is idle.
2018-11-02 09:44:32.646767-0400 wk[5669:2032638] evaluateJavaScript: (function(w){if(!w._cdvMessageHandler) {w._cdvMessageHandler = function(id,d){w.webkit.messageHandlers.cordova_iab.postMessage({d:d, id:id});}}})(window)
2018-11-02 09:44:39.013119-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.013583-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.013827-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.014057-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.014336-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.014561-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.014789-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.015012-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.015234-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.015455-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.015676-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.015898-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.016120-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.016400-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.016622-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.016848-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.017239-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.021299-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.037837-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:44:39.054533-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
2018-11-02 09:45:47.383791-0400 wk[5669:2032638] CDVWKInAppbrowser evaluateJavaScript runloop
I saw someone else also reported the same issue on ios 12 device testing at
https://stackoverflow.com/questions/26778955/wkwebview-evaluate-javascript-return-value
(see the first answer), so this may relate to the iOS 12 behavior change.
Thanks for help.
Jonathan
Hello,
I would like to disappear the toolbar and url address for ios. But it seems it doesn't work.
inAppBrowserRef = cordova.InAppBrowser.open('url', '_blank', 'location=no, zoom=no, toolbar=no');
The toolbar just being there. What is the problem?
I am using InAppBrowser to open a web page from an ionic 3 app. The page which I open has a alphascroll component which is similar to https://github.com/rossmartin/ionic2-alpha-scroll. If I open the page using the InAppBrowser browser target as _blank, when I scroll through the alphascroll to move up and down the lists in alphabetical order, there is a noticeable lag in updating the list and after few scrolls the list goes blank. If I use the targert option as _self or _system the scroll works perfectly. Does anybody know why these rendering issues are seen with the _blank target?
The Page Visibility API allows an app to know whether a page is currently being displayed to a user or not.
It seems that the typical in app browser use case does not honour this.
For example, if a Cordova app shows an in app browser to allow a user to login, the base Cordova web view should report that it is not visible.
The current (IMO incorrect behaviour) is for the page visibility API to return visible for the Cordova web view when the IAB is shown, rendering the page visibility API as useless in Cordova 😞
Hi,
I've experienced error "NSURLErrorDomain error -999" on iOS (tested on iOS12) using [email protected] with [email protected]
var ref = window.open(url, target, options);
ref.addEventListener('loadstart', loadStartCallBack);
ref.addEventListener('loadstop', loadStopCallBack);
ref.addEventListener('loaderror', loadErrorCallBack);
function loadErrorCallBack(params) {
$('#status-message').text("");
var scriptErrorMesssage =
"alert('Sorry we cannot open that page. Message from the server is : "
+ params.message + "');"
ref.executeScript({ code: scriptErrorMesssage }, executeScriptCallBack);
ref.close();
ref = undefined;
}
function executeScriptCallBack(params) {
if (params[0] == null) {
$('#status-message').text(
"Sorry we couldn't open that page. Message from the server is : '"
+ params.message + "'");
}
}
I've found a workaround on following issue. It works well only if I remove ref.addEventListener('loaderror', loadErrorCallBack);
There is an issue with the status bar and the iPhone X as described at https://stackoverflow.com/questions/47399938/issue-with-status-bar-using-cordova-inappbrowser-and-ios-11-and-iphone-x
When the inappbrowser toolbar is at the top of the screen, the status bar on the iPhone X is half white and half gray.
Changing the following line in CDVInAppBrowser.m solves the problem and makes the whole status bar gray. Change line:
statusBarFrame.size.height = STATUSBAR_HEIGHT;
to
statusBarFrame.size.height = 0;
This does not seem to negatively affect other iPhones or iPads.
inappbrowser v3.0.0
使用如下配置:location=no, toolbar=no,hidenavigationbuttons=yes,closebuttoncaption=X,disallowoverscroll=yes,toolbarcolor=#eaeffa,toolbarposition=top,transitionstyle=fliphorizontal,toolbartranslucent=yes'
在iOS11系列的机器上,body顶部被toolbar遮挡,有可配置的参数吗
Since Android updated to webview v 69.0.3497.91, any script that runs that returns content longer than 10240 bytes fails as the message gets truncated
Bug appears here: https://github.com/apache/cordova-plugin-inappbrowser/blob/master/src/android/InAppChromeClient.java#L114
JSONException
occurs as message is invalid JSON (truncated string)
Bug has been lodged with Chrome but they won't fix it:
https://bugs.chromium.org/p/chromium/issues/detail?id=884100
In the bug they report:
I don't think you should rely on prompt() as a means of passing data from JS to Java. There are other APIs that are properly suited to this task.
I am about to try a few ideas either addJavascriptInterface
or evaluateJavascipt
instead of prompt
but would be open to suggestions of other interfaces
Note: This works OK if chrome is uninstalled and the default Android WebView is used
While
updating the Android Cordova 6.2.3 to 7.1.1 getting the following error, I am sure the issue is with the AndroidManifest.xml file but as per the Cordova release notes I have pushed the changes to my config file but still getting this error.
: Error: ENOENT: no such file or directory, open '/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/AndroidManifest.xml'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.parseElementtreeSync (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new AndroidManifest (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/lib/AndroidProject.js:99:12)
at Api.addPlugin (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/Api.js:223:57)
at handleInstall (/Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/src/plugman/install.js:594:10)
at /Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/node_modules/q/q.js:816:30)
(node:76349) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/AndroidManifest.xml'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.parseElementtreeSync (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new AndroidManifest (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/lib/AndroidProject.js:99:12)
at Api.addPlugin (/Users/brains05/KK/PoolTrackr/mobile_app/platforms/android/cordova/Api.js:223:57)
at handleInstall (/Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/src/plugman/install.js:594:10)
at /Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/brains05/KK/PoolTrackr/mobile_app/node_modules/cordova-lib/node_modules/q/q.js:816:30)
(node:76349) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting apromise which was not handled with .catch(). (rejection id: 1)
(node:76349) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Its an ionic project and here its my info
Ionic:
ionic (Ionic CLI) : 4.1.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic1 1.3.0
@ionic/v1-toolkit : 1.0.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (27 plugins total)
System:
Android SDK Tools : 26.0.2 (/usr/local/opt/android-sdk)
ios-deploy : 2.0.0
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 6.4.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
I set the system status bar color as green on startup, but when inappbrowser popup, the status bar turn black, is there any way to keep it as green?
call code:
onButtonClick(itemInfo) {
let descUrl = itemInfo.desc_url;
this.inAppBrowser.create(descUrl, '_self', 'hideurlbar=yes,toolbarcolor=#009999,closebuttoncolor=#FFFFFF,navigationbuttoncolor=#FFFFFF');
}
I want to get rid of the override "window.open" on browser platform. But the suggested solution "delete window.open" does not work in Chrome/69 and "window.open" ends being undefined.
I tried update the plugin to the latest version and tried to build the apk and I got this error.
F:\Work\androidProject\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:260: error: cannot find symbol
((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload = false;
^
symbol: method getWebViewClient()
location: variable inAppWebView of type WebView
Any idea about this?
I am using Ionic 1 and platform android 6.1.0
Edit:
Downgrade to v3.0.0 and successfully built the apk. seems the error happened on v3.0.1-dev
A new version hasn't been published to npm in 6 months. A commit for a serious bug has been made, and needs to be available:
https://github.com/apache/cordova-plugin-inappbrowser/pull/272/files
I have some help docs that I want to render in the InAppBrowser. They are a series of nested HTML, JS and CSS files; when I point to the top level .htm file, the IAB comes up blank since there is nothing in the body; it is used to load other HTML files. However, when I point to a file deeper in the nest, say Home.htm, I can see that page's content, but none of the dynamic content works: the hamburger menu doesn't function, navigation to other pages does not work, etc. The site was built using MadCap Flare; here is one of their example projects that exhibits the same symptoms: https://github.com/skrawn/madcap_example Any ideas about what could cause it?
cordova-lib: 7.1.0
cordova-ios: 4.5.4
cordova-plugin-inappbrowser: 3.0.0
Same behavior in cordova-plugin-inappbrowser-wkwebview
Tested with IPhone 6 - IOS latest Beta of 12, Xcode10 and Simulator for Iphone 6, IOS11.4, Simulator for Iphone XS IOS 12.
Open a Youtube link in inappbrowser. The native video player starts, all OK. Stop, tap on another suggested video. In real device app closes down. In Simulator app freezes.
The highlight in red is displayed right after tap to watch the second video.
Meaning of EXC_BAD_ACCESS
Later Edit: after more testing, I guess it happens with any video source and it seems to be an issue between the inapbrowser and the native video player.
Later..er Edit: all ok if 'allowInlineMediaPlayback=yes' and the native player is not opened. However, if the video is pushed to full screen (native player) -> go to the top of this text.
Chrome recently introduced a limit to the length of data that can be passed through the window.prompt
interface. It is now limited to 10240 bytes.
This interface has been (mis-)used for message passing in the Android implementation.
Unfortunately, this results in some quite unexpected behaviour, when Javascript evaluation results exceed 10240 bytes.
It seems that custom URL schemes are not correctly handled, at least on Android.
For example, this plugin (https://github.com/EddyVerbruggen/Custom-URL-scheme) suggests that users use a forked version of the in app browser to handle these custom URL schemes (
https://github.com/Innovation-District/cordova-plugin-inappbrowser).
The problem is that an in-app-browser & custom URL scheme setup is particularly useful for OAuth authentications in Cordova apps. So trusting some random fork of the In App Browser plugin for these security sensitive use cases seems like a bad idea.
From looking at the source code for In App Browser, it seems that it additionally rejects custom URL schemes and attempts to re-write them, seemingly making intercepting the custom url scheme page loads with the 'loadstart' event not possible: http://git.lunargravity.be/project/Dag-secret-calculator/blob/3587c7a66a932c7de7183776880a55b4047eeb78/plugins/cordova-plugin-inappbrowser/src/android/InAppBrowser.java#L872
To be clear, this only appears to be an issue on android - for whatever reason iOS is perfectly happy loading custom URL schemes from the In App Browser.
Hi All,
We have got a critical production issue in Cordova mobile application related to in-App browser with iOS 12.0 version.
The issue is loadStop() event of InAppBrowser is not being triggered if the URL contains “?” symbol, for normal URL’s it is working fine.
This is the URL we are using to open website from InAppBrowser.
This issue has been raised after device being updated to latest iOS version 12.0.
Request you to kindly provide your support for the same.
Thanks in advance.
On both Android and iOS, ref.close() does not close the window. I can see the webview is still running. Does not seem to be specific to device or OS. However, I have been testing on iPhone X, with iOS 11.4.1 as well as Samsung S5 running Android 6.0.1.
Hi,
I have the following error 'Cordova/CDVWebViewDelegate.h' file not found, can anybody help me??
In cordova inappbrowser ios implementation, after presenting an inappbrowser viewcontroller, the javascript code can call close method to close it, then immediately present another inappbrowser viewcontroller.
Basically the javascript code starts the second inappbrowser instance in the first inappbrowser's close's successcallback method.
However, with the current ios implementation, the close method's successcallback is called in browserExit method. At that moment, the inappbrowser viewcontroller may not yet be dismissed, as a result, opening the second inappbrowser viewcontroller may fail randomly due to this timing issue.
One possible solution is, instead of calling the close methods' succcesscallback from the browserExit method, it can be called on inappbrowser's dismissViewControllerAnimated's completion block. At that moment, the current inappbrowser is already dismissed, and it is safe to open a new inappbrowser instance.
usewkwebview=yes will crash on iOS 9.0 ~ 9.3
10.3.1, 11.0.1, 12.0 work correctly.
Xcode debug console output
XApp[16531:942778] -[WKWebViewConfiguration setIgnoresViewportScaleLimits:]: unrecognized selector sent to instance 0x7fcabdd1fe00
XApp[16531:942778] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebViewConfiguration setIgnoresViewportScaleLimits:]: unrecognized selector sent to instance 0x7fcabdd1fe00'
...
libc++abi.dylib: terminating with uncaught exception of type NSException
I am using a website built with Create React App that utilizes a service worker to allow the application to be opened and viewed when offline. It appears that the inappbrowser does not have built in support for this. Would it be possible to add this or is there another recommended method of serving offline content with inappbrowser?
I am using this plugin in ionic 3.
Here is the piece of code
browser.on('loadstop').subscribe(event => {
console.log(event,"event inside browser on")
browser.executeScript({code: 'mycallback'}).then(data=>{
console.log("script executed",data);
},err=>{
console.log(err,"error in executing the script");
})
});
loadstop event is working fine, but executeScript doesnot work. Its not going to err section also.
Need an option to toggle/allow it ->
WebSettings settings = inAppWebView.getSettings(); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
fixes the blocked issue, which is big because I am running an http webpage through google translate which is https. Both inwhich I cannot manage, google translate is https only, the webpage is only http.
For example, if I’m on our external network and try to hit an internal url it use to call loaderror… now I just get a blank page and no event. This mostly happens on an iPhone X. It occasionally happens on my iPhone 7 (running iOS 12).
Is it possible somehow to listen to click events triggered within the InAppBrowser?
On iPhone X and higher the inappbrowser looks like this (I'm referring to the status bar):
I have added the new splashscreen image and the app itself looks great. Is there a way to fix this?
Is there also a way to keep the content of the inappbrowser from going under the "homebar"?
Phonegap uses "constant(safe-area-inset-bottom)" and "env(safe-area-inset-bottom)" for this.
We can not open device's native camera or see any option to open it when we clicked the input type="file" in Android devices. Is there any solution ?
Hi,
Currently both CDVWKInAppBrowser and CDVUIInAppBrowser are inherited from generic root interface of CDVPlugin. However, since CDVWKInAppBrowser and CDVUIInAppBrowser have the similar functions, they have many functions with the same implementation.
In order to avoid the duplicated code for easy maintenance, it is better to have a common base interface (like CDVInAppBrowserBase) containing the common code for both CDVUIInAppBrowser and CDVWKInAppBrowser interface.
Actually, it makes sense if the logic can be refactored to use CDVInAppBrowser as the base interface, and then derives CDVWKWebView and CDVUIWebView from it, instead of deriving all of them from CDVPlugin.
Thanks
Jonathan
In #276 (CB-14188) the beforeload
event was added.
This event currently uses the same callback mechanism as other events, but it is different in one important aspect: instead of just notifying that something happened, it expects an action to be called. It would be good to allow a synchronous callback instead.
Hi,
This is a great plugin! thanks for all the hard work!
In the documentation it is suggested to do the following:
window.open = cordova.InAppBrowser.open;
However when using typescript this is not possible without using any
or something similar.
Please add the relevant declaration to the types file.
On orientation change, from portrait to landscape, a grey block appears in the top left hand corner of the screen.
inappbrowser version - 3.0.0
cordova version - 7.1.0
Currently when I open a website with InAppBrowser and Android which have an invalid certificate (because of a missing chaining certificate) InAppBrowser only display a black screen and dispatch two event, a "loadstart" event and a "loadend" event.
I think that InAppBrowser should fire a "loaderror" event in order to known that something bad happened with ssl.
usewkwebview=yes will crash on iOS 9.0 ~ 9.3
10.3.1, 11.0.1, 12.0 work correctly.
Xcode debug console output
XApp[16531:942778] -[WKWebViewConfiguration setIgnoresViewportScaleLimits:]: unrecognized selector sent to instance 0x7fcabdd1fe00
XApp[16531:942778] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebViewConfiguration setIgnoresViewportScaleLimits:]: unrecognized selector sent to instance 0x7fcabdd1fe00'
...
libc++abi.dylib: terminating with uncaught exception of type NSException
This is the configration that is failing:
"os": "linux",
"env": "PLATFORM=android-7.0",
"jdk": "oraclejdk8",
Last successful build was:
https://travis-ci.org/apache/cordova-plugin-inappbrowser/builds/344652192
(Feb 22)
First failing build was:
https://travis-ci.org/apache/cordova-plugin-inappbrowser/builds/357149499
(Mar 21)
(end of page #1 of https://github.com/apache/cordova-plugin-inappbrowser/commits/master right now)
Error message on Travis was:
...
..............................................
cordova-paramedic: connecting to app
cordova-paramedic: waiting for test results
cordova-paramedic: Tests failed to complete; ending appium session. The error is:
Error: Seems like device not connected to local server in 300 secs
at null._onTimeout (/tmp/paramedic/lib/paramedic.js:467:24)
at Timer.listOnTimeout (timers.js:92:15)
Running Appium tests on Sauce Labs
Couldn't find Appium tests, skipping...
Completed tests at 10:02:21 AM
Getting saucelabs jobs details...
============================================================================================
Job name: travis-plugin-inappbrowser-436.10
Job ID: 11b69418b01a4cc1b09607b000b9e40c
Job URL: https://saucelabs.com/beta/tests/11b69418b01a4cc1b09607b000b9e40c
...
Commit was: 65a825a So nothing concerning Android, so probably more a testing environment thing.
Most commits after that one were failing with the same test failing.
Some succeeded without a real reason.
Some other more recent commits succeeded because the test was just removed.
More recent test run that is failing, where the video and logs are still available on Saucelabs:
cordova-paramedic: connecting webdriver
...........................
cordova-paramedic: connecting to app
cordova-paramedic: waiting for test results
cordova-paramedic: Tests failed to complete; ending appium session. The error is:
Error: waitForTests: Seems like device not connected to local server in 540 secs
at null._onTimeout (/tmp/paramedic/lib/paramedic.js:467:24)
at Timer.listOnTimeout (timers.js:92:15)
Running Appium tests on Sauce Labs
Couldn't find Appium tests, skipping...
Completed tests at 1:25:20 PM
Getting saucelabs jobs details...
============================================================================================
Job name: travis-plugin-inappbrowser-516.10
Job ID: 8a2a6c5d12714125b366852914355361
Job URL: https://saucelabs.com/beta/tests/8a2a6c5d12714125b366852914355361
Video: https://assets.saucelabs.com/jobs/8a2a6c5d12714125b366852914355361/video.flv
Appium logs: https://assets.saucelabs.com/jobs/8a2a6c5d12714125b366852914355361/selenium-server.log
Logcat logs: https://saucelabs.com/jobs/8a2a6c5d12714125b366852914355361/logcat.log
============================================================================================
The screenshot indicates that the tests run and and finish just fine.
On Android, when setting footer
to yes
, the footer bar overlaps the WebView content, causing it to cover up the bottom slice of the WebView.
I was able to fix the issue by forking the library and using setMargins
on the WebView's LinearLayout.LayoutParams
equal to the height of the footer, but I only did that because I could not get any other way to work so I am not sure if this is the best way to fix the problem.
My fix is below.
FROM:
inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
TO:
int footerSize = this.dpToPixels(44);
inAppWebView = new WebView(cordova.getActivity());
LinearLayout.LayoutParams webViewLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
if (showFooter) {
webViewLayoutParams.setMargins(0, 0, 0, footerSize); // Adding margin the same size as the footer
}
inAppWebView.setLayoutParams(webViewLayoutParams);
When loading a local host with relative path using Ionic 3, I get an ERR_CONNECTION_REFUSED error.
The URL specified is "assets/resources/some-page.html" which then is turned into "http://localhost:8080/assets/resources/some-page.html". All whitelisting has been configured to allow this, and using the plugin with external URLs works just fine.
I would like to bring to attention an issue (I believe it's a bug, could be wrong) which I've come across. I believe it is easy to reproduce, and managed to successfully reproduce it repeatedly myself on a test environment. Zip file linked bottom of issue containing the test environment. GIF showing the issue added below.
In brief, the problem is that on some particular sites, whenever navigation / keyboard is triggered in the InAppBrowser window, it is causing the underlying application to freeze and become unresponsive to any user actions.
Environment: Cordova 8, iOS 4.5.5 and Ionic 3
Affected Platform : iOS
Versions: iOS v11.4
Devices Affected: iPhone 5 up to 6S/Plus
Steps to reproduce:
Link to test environment : iab-test.zip
After the inAppBrowser is closed (after viewing a website), the app does not respond to normal touch events - touch, swipe etc.
The app still handles timer events in the background, so potentially this is an issue with how events are intercepted between the inAppBrowser and the underlying app, but the interceptor is not removed correctly when the inAppBrowser is closed.
It is normal for sound to play when playing YouTube videos in browsers or in apps when the phone is on silent - however this doesn't happen in the inappbrowser, as such I'm needing to add a warning instructing users if they hear no sound to un-mute the phone - please can there be an option to allow audio from the inappbrowser even when the phone is on silent.
I am trying make authentication to the server. When i open the url in browser it prompts for authentication.
The same i have tried with inappbrowser but it wont prompts for authentication directly it redirects to unauthorised access. Unable to get authentication prompt to authenticate
Below is the prompt when i open in browser
While url
, target
and options
are documented, there is no description/documentation for the optional replace
parameter in the index.d.ts file (line 45). The function is:
open(url: string, target?: string, options?: string, replace?: boolean): InAppBrowser;
I'm curious whats replace
about.
Hi
Currently, i am using latest inappbrowser plugin 3.0.0
node v8.11.1
npm v5.6.0
PhoneGap cli-8.0.0
Facing some issues in iPhone X device.
Current behavior:
Expected behavior
Option Fileds that I am using.
Code :
hidden=yes,mediaPlaybackRequiresUserAction=yes,closebuttoncaption=Done,toolbarposition=top,enableViewportScale=yes,toolbar=yes,toolbarcolor=#8bc34a,hidenavigationbuttons=no,navigationbuttoncolor=#ffffff,closebuttoncolor=#8bc34a
Thanks In Advance 🙏:skin-tone-2:
Just upgrade our product ios Fiori client app with the updated inappbrowser plugin for master with the wkwebview support.
However, somehow after loading the web content in the main webView (UIWebView or WKWebView), the UI element in the main webview is disabled. Clicking on the button or other UI element does not have any response.
The same app with inappbrowser version 2.0 works as expected.
To repeat the issue, the three ios projects are shared at the below folder:
https://sap-my.sharepoint.com/:f:/p/jonathan_li/EmulfDR6x9RBuQdj5u1-NrwBYchculWO6RAfoC_NTM8XLw?e=YzzUkh
2.0WithUIWebView.zip
Fiori client build with inappbrowser plugin version 2.0.x. The main webview uses UIWebView.
masterWithUIWebview.zip
Fiori client build with inappbrowser plugin from master. The main webview uses UIWebView.
masterWithWKWebView.zip
Fiori client built with inappbrowser plugin from master. The main webview uses WKWebView.
Steps to repeat the issue:
When the project is built with inappbrowser 2.0 and UIWebView (2.0WithUIWebView.zip), click the "See it in action" button will go to the next page. In addition, double tab on the screen will show the toolbar items.
But after upgrading the project to latest inappbrowser plugin (masterWithUIWebview.zip), the main UIWebview does not response to the button click, or double tab. I also built a project with WKWebView as main UIwebView (masterWithWKWebView.zip), and got the same result.
Please look into this issue and see what causes this behavior change, particularly for the case when UIWebView is used as main webView.
Thanks
Jonathan
I am using ionic 3 plugin to view pdf inappbrowser. It is working fine in ios but not working in android.
I am using following code :
this.iab.create("pdfurlhere", "_blank").show();
I am getting any error and log in new window.
This seems to be a known issue previously, but using inappbrowser simply won't give me the normal options on android for uploading files in a browser form, whereas ios seems fine (once I'd added the permissions to the config.xml). I can see there are various pull requests that fix this so I suspect I'm doing something wrong.
I've tried adding various native plugins to add permissions in case that changes it, or used the config.xml to add the permissions to the androidmanifest.xml for the camera in case it's that that's stopping it but I'm never granted the permissions.
My app.module.ts is
import { BrowserModule } from "@angular/platform-browser";
import { ErrorHandler, NgModule } from "@angular/core";
import { IonicApp, IonicErrorHandler, IonicModule } from "ionic-angular";
import { MyApp } from "./app.component";
import { HomePage } from "../pages/home/home";
import { ListPage } from "../pages/list/list";
import { StatusBar } from "@ionic-native/status-bar";
import { SplashScreen } from "@ionic-native/splash-screen";
import { InAppBrowser } from "@ionic-native/in-app-browser";
import { AndroidPermissions } from "@ionic-native/android-permissions";
@NgModule({
declarations: [MyApp, HomePage, ListPage],
imports: [BrowserModule, IonicModule.forRoot(MyApp)],
bootstrap: [IonicApp],
entryComponents: [MyApp, HomePage, ListPage],
providers: [
StatusBar,
SplashScreen,
{ provide: ErrorHandler, useClass: IonicErrorHandler },
InAppBrowser,
AndroidPermissions
]
})
export class AppModule {}
home.ts
import { Component, OnInit } from "@angular/core";
import { NavController } from "ionic-angular";
import {
InAppBrowser,
InAppBrowserOptions
} from "@ionic-native/in-app-browser";
import { AndroidPermissions } from "@ionic-native/android-permissions";
@Component({
selector: "page-home",
templateUrl: "home.html"
})
export class HomePage {
constructor(
public navCtrl: NavController,
private inAppBrowser: InAppBrowser,
private androidPermissions: AndroidPermissions
) {}
openWebpage(url: string) {
const options: InAppBrowserOptions = {
zoom: "no",
location: "no",
hidenavigationbuttons: "yes",
hideurlbar: "yes",
footer: "yes",
toolbar: "yes",
closebuttoncaption: "Return to home",
toolbarcolor: "#ffffff"
};
// Opening a URL and returning an InAppBrowserObject
const browser = this.inAppBrowser.create(url, "_blank", options);
this.androidPermissions
.checkPermission(
this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE
)
.then(
result => console.log("Has permission?", result.hasPermission),
err =>
this.androidPermissions.requestPermission(
this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE
)
);
this.androidPermissions
.checkPermission(this.androidPermissions.PERMISSION.CAMERA)
.then(
result => console.log("Has permission?", result.hasPermission),
err =>
this.androidPermissions.requestPermission(
this.androidPermissions.PERMISSION.CAMERA
)
);
this.androidPermissions.requestPermissions([
this.androidPermissions.PERMISSION.CAMERA
]);
// Inject scripts, css and more with browser.X
}
}
ionic info
ionic info
✔ Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.1.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.11
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.1, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic 5.0.5, cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 8 other plugins)
System:
Android SDK Tools : 26.1.1
ios-deploy : 2.0.0
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Environment:
ANDROID_HOME : /Users/Paul/Library/Android/sdk
plugins installed (some aren't used now, I added file, and camera to see if they added the camera permissions to the app)
ionic cordova plugins list
> cordova plugin ls
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic 5.0.5 "cordova-plugin-ionic"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.0.3 "cordova-plugin-ionic-webview"
cordova-plugin-media-capture 3.0.2 "Capture"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
I'm running the app on a Mac, using the command 'ionic cordova run android --device'
I have an unlocked Galaxy s7 in usb debug mode connected which is running the app. When I access the same webpages in the normal browser I get all the camera options I'd expect. The android version is 8.0.0, with the Samsung Experience of 9.0
The output from the debug console tells me that I have file write permissions, but not camera permissions. I also can't add that permission in the android settings as it never appears.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.