我认为这将是一个简单的 2 行集成,如此处所示。但是在添加正确的 CSP 以允许在线执行之后,行为并不符合预期。窗口弹出并立即关闭。
这是我的 popup.html
<html>
<head>
<title>Quick Launcher</title>
<link rel="stylesheet" href="style.css" />
<script src="https://www.paypal.com/sdk/js?client-id=sb"></script>
</head>
<body>
<h1>My chrome</h1>
<script>paypal.Buttons().render('body');</script>
</body>
</html>
清单.json
{
"manifest_version": 2,
"name": "Quick Launcher",
"description": "Smart links organizer. Create collection of related links or add urls of different environments(uat, prod) of various deployed apps",
"version": "1.2.10",
"icons": {
},
"browser_action": {
"default_icon": {
},
"default_popup": "popup.html"
},
"content_security_policy": "script-src 'self' https://www.paypal.com 'sha256-U2vsCzUQ797LcHkgCQJsOSAJxY/+LTdJONJ+wacPXrI='; object-src 'self' https://www.paypal.com 'sha256-U2vsCzUQ797LcHkgCQJsOSAJxY/+LTdJONJ+wacPXrI='; script-src-elem 'self' https://www.paypal.com 'sha256-U2vsCzUQ797LcHkgCQJsOSAJxY/+LTdJONJ+wacPXrI='",
"background": {
"scripts": [
"background.js"
]
},
"permissions": ["tabs", "activeTab"]
}