我正在尝试创建一个 Chrome 扩展程序,当单击扩展程序按钮时,该扩展程序会将 CSS 注入页面。
弹出窗口加载正常,但无法注入 CSS。
清单.json:
{
"name": "Flat Firemem",
"version": "1.0",
"manifest_version": 2,
"description": "Arranges the page properly in the dump.",
"browser_action": {
"default_icon": "logo.png",
"default_popup": "popup.html"
},
"permissions": ["tabs", "<all_urls>", "file:///*"]
}
Run Code Online (Sandbox Code Playgroud)
弹出窗口.html
<!DOCTYPE html>
<html style=''>
<head>
<script src='tester.js'></script>
</head>
<body style="width:400px; border: 2px solid black;background-color:LightGray;">
<div id='message'>Hello..!!</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
样式文件
*
{
float: none !important;
position: static !important;
}
table, tbody, td, tfoot, th, thead, tr
{
display: block !important;
}
Run Code Online (Sandbox Code Playgroud)
测试者.js:
chrome.browserAction.onClicked.addListener(function(tab) { …Run Code Online (Sandbox Code Playgroud) 这是我删除文件夹的代码,下面的代码不会删除主文件夹下的Downloads目录.
import java.io.IOException;
public class tester1{
public static void main(String[] args) throws IOException {
System.out.println("here going to delete stuff..!!");
Runtime.getRuntime().exec("rm -rf ~/Downloads/2");
//deleteFile();
System.out.println("Deleted ..!!"); }
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我给出完整的主路径,这可行:
import java.io.IOException;
public class tester1{
public static void main(String[] args) throws IOException {
System.out.println("here going to delete stuff..!!");
Runtime.getRuntime().exec("rm -rf /home/rah/Downloads/2");
//deleteFile();
System.out.println("Deleted ..!!");
}
}
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我做错了什么?