We can Set/Get/Clear users’ clipboard by the JavaScript window.clipboardData object, which only works in Internet Explorer, by the following code:
 
window.clipboardData.setData("text",value)
window.clipboardData.getData("text")
window.clipboardData.clearData("text")
 
If you need set a code-behind value to user’s clipboard, please pass it to JavaScript variable first, and then, set the value to clipboard. Or you can call the JavaScript from code-behind, just like the following code:

 

protected void Button1_Click(object sender, EventArgs e)
{
    
string values = "hello world";
    ClientScript.RegisterStartupScript(
this.GetType(), "copy""window.clipboardData.setData('text','"+values+"')"true);
}


Thanks.

相关文章:

  • 2021-09-01
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
猜你喜欢
  • 2021-11-05
  • 2021-05-25
  • 2022-01-31
  • 2022-01-10
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案