IE clipboard access under

clipboard data through clipboardData object access, it has getData (), setData (), clearData () three ways.

window.clipboardData.getData(type): Gets the data  ;
window.clipboardData.setData(type, value): Sets the data for the  value;
window.clipboardData.clearData(): Clear data  ;

type Typically evaluates to ' Text ', indicating that the text formatting  . Another value is ' URL ',  URL Format  .

Related events:
beforecopy, copy, beforecut, cut, beforepaste, paste

We can beforecopy, beforecut, beforepaste processing function to change the clipboard's contents, but to cancel the event, you must copy, cut, paste function for the event.

Examples:

document.forms[0].elements['area1'].attachEvent('onpaste',function(){
    var data = window.clipboardData.getData('Text');
    if(!/^\d*$/.test(data)){
        window.event.returnValue = false;
    }
});
document.body.attachEvent('oncopy',function(){
     window.event.returnValue = false;
    window.clipboardData.setData('Text',' Replication is not valid  ');

});

See more effective only in IE, other browsers view of security issues, does not allow access to clipboard or set of related constraints. Want to copy the contents to the clipboard, an implementation method is to use the flash, to copy the code to javaeye achieved. Later learning.

分类:Web 时间:2010-07-13 人气:273
分享到:
blog comments powered by Disqus

相关文章

  • Common Web application security issues (1 - 4) (a) 2010-05-31

    After the two ("Web security issues of hierarchy" and "Understanding the essence of Web application security issues") on the Web security and Web application security conceptual knowledge of the macroscopic description, I believe we ha

  • tomcat security issues 2010-03-29

    Project the need for security issues sufficient attention, such as the following tomcat security issues easily be overlooked: The default server.xml has the following line: <Server Port="8005" shutdown="SHUTDOWN"> This allows any

  • Cross-domain access security issues 2010-03-12

    Cross-domain access to security issues, call the following function in the load /** * Returns the LoaderContext * @param checkPolicyFile If the policy file * @return */ public static function getLoaderContext(checkPolicyFile:Boolean = true):LoaderCon

  • MySQL security issues under the --. mysql_history you noticed? 2011-05-06

    MySQL security issues under the --. mysql_history you noticed? Today, careless in / root directory, see a hidden file on the mysql --. mysql_history, because in the past have not paid attention, then opened to see what stuff. Did not want to open the

  • Two Spring Security issues 2011-05-04

    Two Spring Security issues ---------" Phenomenon 2011-5-4 9:22:20 org.springframework.web.context.ContextLoader initWebApplicationContext Serious: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating b

  • Internet-related security issues 2011-03-25

    Here are some Internet applications may encounter some security issues XSS attacks Xss: is posted on the website of some javascript code in question, when users click on the code, it is possible to use the user's permission to do some things the gene

  • MySQL and security issues --. mysql_history you noticed? 2011-05-06

    MySQL and security issues --. mysql_history you noticed? Today are not careful in the / root directory to see a hidden file on mysql --. mysql_history, because in the past have not paid attention, then opened to see what stuff. Open shocked not think

  • Database, three major issues: constraints. CASE statements and documents (transfer) 2010-09-20

    This paper describes the use of instance methods on the binding, CASE statements and documents three problems. Constraint "Is defined as can be delayed (deferrable)" constraint can specify: 1. Initially immediate (real-time implementation of the

  • View the LAN using Wireshark security issues 2010-03-10

    Heard about the security of local area network problem, but it has no heart, Shoko is a computer science graduate, online behavior is usually the rules, never mess on those sites where small-lattice has its own dedicated computer , containing the net

  • [Change] Servlet thread-depth study of security issues 2010-05-04

    Abstract: Servlet multi-threaded mechanism, a case combined with Java's memory model shows the causes of insecurity caused by Servlet Thread given to ensure the three Servlet thread-safe solution, and describes the practical development of three prog

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.279 (s). 12 q(s)