I want to get the cursor position of an editable iFrame (using designMode). Here is the code I have so far:
document.getElementById('iframe_id').contentWindow.document.getSelection().getRangeAt(0)
From there, getting the property startOffset
gets the number of characters from the beginning of that line, but not from the beginning of the iFrame document. I would like to get the cursor position relative to the beginning of the document.
Please note: I am not interested in setting the cursor position; I just want to get it.
Preferably, I would like the fix to be compatible with Chrome/Safari/Firefox; compatibility with IE is not necessary.
Any help would be greatly appreciated.