Also can you please answer this question? how do I get co-ordinates of selected text in an html using javascript document.getSelecttion()
thanks开发者_开发技巧
You get error message Deprecated method document.getSelection() called. Please use window.getSelection() instead." in Firefox which means document.getSelection() is a deprecated method.
They seem to be the same:
https://w3c.github.io/selection-api/#dom-document-getselection
getSelection()method
The method must return the selection associated withthisifthishas an associated browsing context, and it must return null otherwise.
https://w3c.github.io/selection-api/#dom-window-getselection
getSelection()method
The method must invoke and return the result ofgetSelection()onthis'sWindow.documentattribute.
Editors of MDN say they're equivalent:
https://developer.mozilla.org/en-US/docs/Web/API/Document/getSelection
You can call
Window.getSelection(), which works identically toDocument.getSelection().
https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection
You can call
Document.getSelection(), which works identically toWindow.getSelection().
加载中,请稍侯......
精彩评论