繁体   English   中英

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

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

嘿,我在iframe中使用翻转书的网址:

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

因此,当我点击iframe内的下载按钮(来自翻转书的网址)时,应用在几秒钟后崩溃。 但是下一张和上一张幻灯片正在工作

离子型:

离子(离子CLI):4.0.2

离子框架:离子角

3.9.2 @ ionic / app-scripts:3.2.0

科尔多瓦:

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

Cordova平台:不可用

系统:

Android SDK工具:25.2.5

NodeJS:v8.9.3

npm:5.4.2

作业系统:Windows 10

我在iframe中找到了它:但似乎无法在移动设备上运行:publication.pdf在网站上正常运行。

我找到了解决方案:将html iframe编辑为:

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

.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");
      });
    }

至少当您单击下载按钮时,pdf打开

暂无
暂无

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

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