Firefox Extension: Get selected text

后端 未结 3 2076
南笙
南笙 2021-02-08 14:27

I am working on a simple Firefox Extension and I want to get the selected text. I tried this:

var WordCount = {
    /* ... */
    changeSelected: function() {
           


        
3条回答
  •  悲哀的现实
    2021-02-08 14:57

    Your problem is that document.commandDispatcher.focusedWindow is going to be pointing to a chrome window, where I suspect you actually want a content window. Try replacing that with content.getSelection()

提交回复
热议问题