Automatic link source in your every copy paste text.
Add this script in your master page/page and change text "Your Site Name" with your website name and enjoy.
<script type="text/javascript">
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 © Your Site Name";
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>
<script type="text/javascript">
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 © Your Site Name";
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>
Comments
Post a Comment