|
Copied To Clipboard!
<html>
<head>
<title>Add Author Credit Link</title>
<script type="text/javascript">
/* Begin Add Author Credit Link
== This Script Free To Use Providing This Notice Remains ==
== This Script Has Been Found In The https://snapbuilder.com Free Public Codes Library ==
== NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply ==
*/
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright SnapBuilder.com"; // change this to your needs
var copytext = selection + pagelink;
var newdiv = document.createElement('div');
newdiv.style.position='absolute';
newdiv.style.left='-99999px';
body_element.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function() {
body_element.removeChild(newdiv);
},0);
}
document.oncopy = addLink;
</script>
</head>
<body>
<p>Just add this code snippet between your document HEAD tags, and change the copyright notice to your needs.</p>
<p>To test it out, copy something from the paragraph below and paste it into your favorite text editor.</p>
<div style="padding:10px;width:90%;font-family:verdana;font-size:13px;line-height:17px;border:1px solid #007730;background:#eee;">
This is some random text to show you how the "Add Author Credit Link" JavaScript code snippet works on a web page.
</div>
</body>
</html>
|