chrome 应用,css 在 iframe 内

chrome app, css inside iframe

我有一个 chrome 应用程序,里面有 iframe

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet" />


<title>Title</title>
</head>
<body >
  <div class="container-fluid">
      <iframe id="iframe" src="home.html" frameborder="0" height="150%" style="width: 100%;"></iframe>
  </div>
</div>
</body>
</html>

在网络中正在加载,但是当它从 chrome 应用程序中的索引调用时,bootstrap-theme.css 没有加载

我也试过添加 type="text/css" ,但都没有。

<link rel="stylesheet" type="text/css" href="/css/bootstrap-theme.css">

这对你有用吗?

我认为您应该允许将此文件附加到 manifest.json,如下所示:

"content_scripts": [
    {
      "matches": ["http://test-website.com/*"], 
      "js": ["js/content-script.js"],
      "css" : ["yourcss.css"]
    }
],

解决方案:

如@SaucedApples 所说但没有点。

<link href="/css/bootstrap-theme.css" rel="stylesheet"   />