Links in inAppBrowser - open with _system and executeScript


#1

Hi guys! (and girls lol)

So, I know how to open links within inAppBrowser with _system (in safari @iphone/ipad for example). What I dont know is this:

I got links - some with url:

the links with frame open external-page.com in iframe. I do somethink like that for now:

document.addEventListener('click', function () {
    $cordovaInAppBrowser.open('http://my-application.com, '_blank', {location: 'yes', clearcache: 'yes', toolbar: 'no'});
}, false);

$rootScope.$on('$cordovaInAppBrowser:loadstart', function (e, event) {
    if (event.url.indexOf('frame') > -1) {
        $cordovaInAppBrowser.open(event.url, '_system', '');
        $cordovaInAppBrowser.executeScript(
            {
                code: "window.history.go(-2);"
            }
        );
    } else if (event.url.indexOf('my-application') <= -1) {
        $cordovaInAppBrowser.open(event.url, '_system', '');
        $cordovaInAppBrowser.executeScript(
            {
                code: "window.history.go(-1);"
            }
        );
    }
});

Its working! :wink: History.go(-1) because the page is opening in safari and in inAppBrowser - both in the same time.

When “frame” is in url it open _system. Ok, but then I want to get the iframe src="" and redirect to that url. Any ideas?

ps.
my-application.com is one of my webpage available on the internet. I cant change anything there.