I need to get all of the text in a Chrome page that I highlight with my mouse, I know very little about javascript but I found this:
var text = "";
if (window.getSelection){
text = window.getSelection().toString();
console.log(text)
} else if (document.selection && document.selection.type !=
"Control") {
text = document.selection.createRange().text;
}
}
Which works once, so is there a good way to iterate this so each time I highlight it prints what I highlighted?