首页 > 解决方案 > iframe 内的基本网址无法正常工作

问题描述

我在该网络应用程序上托管了一个网络应用http://localhost:3000
程序,我有一个 iframesrc="http://localhost:8000

我的问题是,即使我在 iframe 中有基本标记,也http://localhost:3000使用该 iframe 内的相对路径http://localhost:8000

主要.html:http://localhost:3000

<iframe src="http://localhost:8000"></iframe>

iframe.html:http://localhost:8000

<!DOCTYPE html>
<html lang="en">
<head>
  <base href="http://localhost:8000/">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="/static/assets/css/index.css">
  <!-- this is using http://localhost:3000 instead of http://localhost:8000 -->
</head>
<body>

</body>
</html>

在此处输入图像描述

我在某处做错了吗?

标签: javascripthtmliframe

解决方案


推荐阅读