Chrome Extension Highlighted Text selection chrome.tabs

Viewed 2605

I'm having trouble with chrome extensions,. I have the permission "tabs" but I don't know how to retrieve the selected text on the page WITHOUT< a background page. <---- I change my mind about this, background pages I can have.

This was the scripting:

var code = document.getSelection().toString();
document.getElementsById("q").value = code;

I had placed a chrome.executeCommand method (can't remember how the method was oriented), but that didn't work either. I don't want a background page to prevent lag when this extension is installed. It may not vause much lag when I have a background, but every piece counts. Also, basically my extension will be about a Portable Google It! extension and if you highlight/select text that it will set the value of the input field automatically. Click https://www.dropbox.com/sh/c7q2puadva2vojf/GsuwWcXHjr to see the my progress so far!

1 Answers
Related