You want to be doing this in a content script
[http://code.google.com/chrome/extensions/content_scripts.html] rather
than a toolstrip.  A content script has access to the page's DOM, and
can interact with it.  Toolstrips are more for general UI for the
extension.

You can see the results of console.log from a toolstrip if you go to
the page chrome://extensions and click the Inspect link next to the
toolstrip.  The results of console.log from a content script will be
in the page's log.

You can communicate between toolstrips and content scripts (so that
pressing a button causes an action in the content script).  This can
(I believe only, though I may be wrong) be done by making a background
page, having the content script and toolstrip each connect to it
(using chrome.extension.connect), and passing messages over these
ports.

On Thu, Sep 10, 2009 at 10:25 PM, Anatoly Yakovenko
<[email protected]> wrote:
>
> So i thought this might work:
>
> <script type="text/javascript">
> function quoteText()
> {
>   if(document.getSelection) {
>      document.getSelection.toString().replace(/^/g, ">");
>   }
> }
> </script>
>
> <div class="toolstrip-button"  onclick="quoteText()">
>   <span>Quote</span>
> </div
>
> but its not.  How come i can't get the selection?  also, console.log
> isn't working, my script isn't showing up in the debugger window as an
> option under scripts.  But if i use window.open("here"); it opens a
> window.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to