无法使用 Iframe 加载 Arxiv PDF

问题描述 投票:0回答:1

我尝试使用 iframe 在 React 应用程序上加载 Arxiv PDF 文件(

https://arxiv.org/pdf/2404.14619.pdf
),但出现以下错误。

Mixed Content: The page at 'https://codepen.io/...' was loaded over HTTPS, 
but requested an insecure frame 'http://arxiv.org/pdf/2404.14619'. 
This request has been blocked; the content must be served over HTTPS.

即使我传递了一个 HTTPS URL,这种情况也会发生,该 URL 似乎正在重定向到 HTTP 版本。这是CodePen。知道如何解决这个问题吗?

谢谢。

html reactjs http pdf iframe
1个回答
0
投票

我不确定我是否完全理解你的意思。当我在 React 中运行以下代码时,它显示正确:

import React from 'react';

const PdfViewer = () => {
  return (
    <div>
      <iframe
        title="PDF Viewer"
        src="https://arxiv.org/pdf/2404.14619.pdf"
        width="100%"
        height="800px"
      ></iframe>
    </div>
  );
};

export default PdfViewer;

我在 Chrome 和 Edge 浏览器中测试了该链接,没有任何问题。 Arxiv 网站可能已更新其重定向政策或解决了任何混合内容问题。 Arxiv 可能已进行更改,以确保所有请求在浏览器中一致重定向到安全 HTTPS 版本。

© www.soinside.com 2019 - 2024. All rights reserved.