我正在努力让这一切工作,我不能......我尝试过: - flash版本(至少3个不同的版本) - document.execCommand("copy")在内容脚本中,但也在后台页面中我已经在stackoverflow上检查了很多页面...每个可用的解决方案.
有没有人有一个有效的例子?
编辑:
的manifest.json
{
"name": "test",
"manifest_version": 2,
"version": "1.0",
"description": "test",
"content_scripts": [{
"matches": ["https://somesite.com*"],
"js": ["jquery.js", "script.js"],
"run_at": "document_end",
"css": ["style.css"]
}],
"permissions": [
"clipboardWrite",
"clipboardRead"
]
}
Run Code Online (Sandbox Code Playgroud)
的script.js
$(document).ready(function () {
$('body').append('<textarea id="test"/>');
var $test = $('#test');
$test.text('some text which should appear in clipboard');
$test.select();
document.execCommand('copy');
alert('copied!');
});
Run Code Online (Sandbox Code Playgroud)
以上不起作用.警报显示......
EDIT2:我也尝试过使用flash版本,但它可能不起作用,因为我认为扩展是在localhost上运行的.
我刚安装了StyleCop 4.5,默认模板已被替换为我现在不太欣赏的一些模板.如何将其恢复为默认值?
我想在Facebook上实现一些东西:
现在我有了一个View,它以两种不同的方式加载到Controller中:
public ActionResult Overview()
{
return View("Overview");
}
public ActionResult OverviewPartialView()
{
return PartialView("Overview");
}
Run Code Online (Sandbox Code Playgroud)
在jquery脚本中它看起来像这样:
$(contentContainer).load(_link + 'PartialView');
Run Code Online (Sandbox Code Playgroud)
我的问题是,有没有更好的方法来解决这个问题?我在_ViewStart中尝试过类似的东西:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
if (IsAjax)
{
Layout = null;
}
}
Run Code Online (Sandbox Code Playgroud)
在Controller中有类似的东西:
public ActionResult Index()
{
if (Request.IsAjaxRequest())
return PartialView();
return View();
}
Run Code Online (Sandbox Code Playgroud)
但是在那些解决方案中我遇到了缓存问题,在打开带有布局的页面之后,在AJAX请求中也加载了带有布局的页面.