Last active
October 15, 2023 08:23
-
-
Save akshansh1998/2af503e4de0344c9fd6c10553005b451 to your computer and use it in GitHub Desktop.
Add Link to Copied Text Blogger - Read More at : yourwebsite.com or Copyright Note to the Person Copying it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 &copy; EasyTins"; // change this if you want | |
//The Script Created by https://facttuts.com | |
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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment