Here is a code found on bavotasan.com that will automatically insert a reference link of your web page. Whenever someone copies and paste text from your web page it will add the "Read more at: http://yourwebaddress" to the bottom. Please note that this script does not work for Internet Explorer.
This javascript will insert the "Read more at: http://yourwebaddress"
<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 />";
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;
|
This javascript will insert "Read more.." and copyright information.
Just write your name in the highlighted "your name" spot.
<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 name"; // change this to your 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;
|
Where to Insert the Javascript in Blogger?
Go to Layout
| |
|
Click "Add a gadget"
|
|
Scroll down and select: "HTML/JavaScript"
|
|
Give any title you wish.
Copy the desired javascript.
Paste it into the "Content" box
Click "Save"
|