You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
nicolashenry, heidji, dmitryuk, sagrawal31, sdevamit and 9 more
import {InAppBrowser} from "@ionic-native/in-app-browser";
....
let ref = window.open('https://www.example.com/', '_system');
ref.close(); //does nothing
yes, i had to install the plugin because in iOS window.open doesn't work without having InAppBrowser installed, so before the plugin ref.close() in this scenario would work. now it doesn't
@janpio I am sorry the @ionic-native plugin used in this example could be confusing, i also tested the matter by calling the cordova plugin directly using cordova.InAppBrowser.open and trying to close it also without success, se yeah it's the definitely the plugin's fault.
It would be awesome if one of you both could create a reproduction app with cordova create, implement the minimal code needed to show the problem and put it on GitHub.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
this.receivedEvent('deviceready');
},
// Update DOM on a Received Event
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
setTimeout(() => test(), 3000);
}
};
test = function () {
var ref = cordova.InAppBrowser.open('https://www.google.com', '_system');
setTimeout(() => ref.close(), 3000);
}
app.initialize();
i also created a rep for you, please forgive me if i added too many files in there, i really have no idea about cordova in particular and it doesn't have a built in gitignore file: replink
@janpio actually the behavior of _blank isn't useful to me, it opens inside the app itself and doesn't close either..
i mean it uses the app as a browser
InAppBrowser will not destroy WebView after being closed (by invoking ref.close()) causing memory leaks · Issue #290 · apache/cordova-plugin-inappbrowser
Activity
janpio commentedon Aug 31, 2018
What happens instead? Does it just stay open?
keithdmoore commentedon Sep 1, 2018
Yes. It just stays open.
heidji commentedon Oct 10, 2018
+1
before installing inAppBrowser ref.close() would work on Android. Now it doesn't.
janpio commentedon Oct 30, 2018
Some context please: What is this
ref.close()
you refer to? You used this before using inappbrowser @heidji?heidji commentedon Oct 30, 2018
yes, i had to install the plugin because in iOS window.open doesn't work without having InAppBrowser installed, so before the plugin ref.close() in this scenario would work. now it doesn't
heidji commentedon Nov 16, 2018
@janpio I am sorry the @ionic-native plugin used in this example could be confusing, i also tested the matter by calling the cordova plugin directly using cordova.InAppBrowser.open and trying to close it also without success, se yeah it's the definitely the plugin's fault.
janpio commentedon Nov 16, 2018
Ok, so https://github.com/apache/cordova-plugin-inappbrowser#inappbrowserclose does not actually work but leave the InAppBrowser window that was opened, open?
It would be awesome if one of you both could create a reproduction app with
cordova create
, implement the minimal code needed to show the problem and put it on GitHub.heidji commentedon Nov 16, 2018
sure, go at it, doesn't work:
heidji commentedon Nov 16, 2018
i also created a rep for you, please forgive me if i added too many files in there, i really have no idea about cordova in particular and it doesn't have a built in gitignore file: replink
janpio commentedon Nov 16, 2018
Thanks, the repo is perfect.
While checking it out, I had a look at the documentation. Something popped up at me:
Several of the methods mention that they only work with
_blank
, and the.close
example also uses_blank
.This might be the first thing to investigate.
heidji commentedon Nov 16, 2018
i also suspected something similar, i think i can live with _blank :D
heidji commentedon Nov 16, 2018
@janpio actually the behavior of _blank isn't useful to me, it opens inside the app itself and doesn't close either..
i mean it uses the app as a browser
49 remaining items