简体   繁体   English

在iframe中单击时,iframe ionic3应用程序崩溃

[英]iframe ionic3 app crash when click inside the iframe

Hey I am using flipping book url inside iframe: 嘿,我在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. 因此,当我点击iframe内的下载按钮(来自翻转书的网址)时,应用在几秒钟后崩溃。 But the next and previous slides are working 但是下一张和上一张幻灯片正在工作

Ionic: 离子型:

ionic (Ionic CLI) : 4.0.2 离子(离子CLI):4.0.2

Ionic Framework : ionic-angular 离子框架:离子角

3.9.2 @ionic/app-scripts : 3.2.0 3.9.2 @ ionic / app-scripts:3.2.0

Cordova: 科尔多瓦:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) 科尔多瓦(Cordova CLI):8.1.2(cordova-lib@8.1.1)

Cordova Platforms: not available Cordova平台:不可用

System: 系统:

Android SDK Tools : 25.2.5 Android SDK工具:25.2.5

NodeJS : v8.9.3 NodeJS:v8.9.3

npm : 5.4.2 npm:5.4.2

OS : Windows 10 作业系统:Windows 10

I find this inside iframe : but it seems don't work on mobile: publication.pdf it works normal on website. 我在iframe中找到了它:但似乎无法在移动设备上运行:publication.pdf在网站上正常运行。

i find a solution : edit htlml iframe to : 我找到了解决方案:将html iframe编辑为:

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

.ts file : .ts文件:

 @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 至少当您单击下载按钮时,pdf打开

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM