I'm developing a off-line web-page for iphone safari.
For highlighting the user's selection in web-page. I've implemented following code.
function highlight() {
if (window.getSelection) {
sel = window.getSelection();
if (sel.getRangeAt) {
range = sel.getRangeAt(0);
}
document.designMode = "on";
if (range) {
sel.removeAllRanges();
sel.addRange(range);
}
document.execCommand("HiliteColor", false, "yellow");
document.designMode = "off";
}
}
That's working perfectly for normal selection.
Edit :
How to detect "has user selected entire document or not ?"
What to do ?
Thanks in advance for sharing your knowledge.
Sugar.