Iframe ionic3 app crash when click inside the iframe


#1

Hey I am using flipping book url inside iframe:

<ng-container>
        <iframe 
                [src]="eUrl"
                id="flipping_book_iframe"
                frameborder="0"
                allowfullscreen="allowfullscreen"></iframe>
</ng-container>

So when I click on download button (coming from the flipping book url )inside the iframe the app crash after some seconds. But the next and previous slides are working

Ionic:

ionic (Ionic CLI) : 4.0.2

Ionic Framework : ionic-angular

3.9.2 @ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)

Cordova Platforms: not available

System:

Android SDK Tools : 25.2.5

NodeJS : v8.9.3

npm : 5.4.2

OS : Windows 10

it works normal on website just on mobile ,
I found this code inside the iframe i think the problem it inside it :
<a class="tocSpan" target="_blank" href="https://flip.ethrai.sa/know-mgt/files/assets/common/downloads/publication.pdf?uni=425316aa7c3c490976d361744e610c68" style="padding-left: 32px; color: rgb(240, 240, 240); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 78%; float: left; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); touch-action: none;">publication.pdf</a>


#2

solution:
i find a solution :
edit htlml iframe to :

<ng-container>
    <iframe 
            [src]="eUrl"
            id="flipping_book_iframe"
            #flippingBook
            (load)="onLoadFlippingBook()"
            frameborder="0"
            allowfullscreen="allowfullscreen"></iframe>
</ng-container>

.ts file :

 @ViewChild('flippingBook') flippingBookIframe: ElementRef;

onLoadFlippingBook(){
    if(this.flippingBookIframe){
      let iframe = jQuery('#flipping_book_iframe');
      let allAs = iframe.contents().find('a[target=_blank]');
      allAs.on("click",function(e){
        e.preventDefault();
        let url = this.href;
        window.open(url,"_system");
      });
    }

at least when u click on download button the pdf opened