微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Framework7 + Cordova |使 iframe 打开本地文件

如何解决Framework7 + Cordova |使 iframe 打开本地文件

大家好。

我正在使用 Framework7 制作应用程序。 有路由。我得到了组件“page.f7.html”和名为“1”的文件夹,里面有“index.f7.html”,文件夹“data”里面有“script.js”(.pptx文件转换为.html)。

--page.f7.html
--1
  |
  --index.f7.html
  --data
    |
    --scripts.js

我需要将 iframe 添加到我的组件中,所以我的 page.f7.html 看起来像这样:

<template>
    <div class="page">
        <div class="navbar">
            <div class="navbar-bg"></div>
            <div class="navbar-inner sliding">
                <div class="left">
                    <a href="#" class="link back">
                        <i class="icon icon-back"></i>
                        <span class="if-not-md">Back</span>
                    </a>
                </div>
                <div class="title">Задача 1</div>
            </div>
        </div>
        <div class="page-content">
            <iframe style="width: 100vw;height: calc(100vh - 110px);" id="frame-pptx" src="/lessons/tasks/1/index.f7.html" frameborder="0"></iframe>
        </div>
    </div>
</template>
<script>
    export default () => {
        return $render;
    };
</script>

但是,iframe 不起作用。我得到的错误是:


    Screen:
    Cannot GET /lessons/tasks/1/index.f7.html
    
    Console:
    Failed to load resource: the server responded with a status of 404 (Not Found)
    http://localhost:8080/lessons/tasks/1/index.f7.html

我尝试了另一种选择 - 路由到 index.f7.html

<iframe style="width: 100vw;height: calc(100vh - 110px);" id="frame-pptx" src="/lessons/tasks/cont/1/" frameborder="0"></iframe>

这里我从控制台收到两个错误


    [Error] Failed to load resource: the server responded with a status of 404 (Not Found) (http://localhost:8080/lessons/tasks/cont/1/js/app.js,line 0)
    [Error] Refused to execute http://localhost:8080/lessons/tasks/cont/1/js/app.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.

由于某些原因使得寻求js/app.js

我正在寻求您的帮助或建议。我需要更改或修复什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。