Page Action 'OnClick Listener'

649 views
Skip to first unread message

hexid

unread,
Jan 23, 2010, 10:24:03 PM1/23/10
to Chromium-extensions
I have gotten the page action to be shown when needed but when the
user clicks on the page action then many new tabs open with the
options page...

Here is the code...

background.html:

chrome.pageAction.onClicked.addListener(function(tab)
{chrome.tabs.create({url: 'options.html'})});

Thanks for any help...

-- Hexid

hexid

unread,
Jan 24, 2010, 9:34:34 PM1/24/10
to Chromium-extensions
Ok...I found a fix for this...

instead of handling the tab creation in the background page...I moved
it to a popup.html page and below is the code...

popup.html:

<html>
<head>
<script>
chrome.tabs.create({url: "options.html"});
window.close();
</script>
</head>
</html>

This opens the new tab and closes the popup...for some reason the
popup is never shown which is good in my case


-- Hexid

Ernest Delgado

unread,
Jan 25, 2010, 1:06:53 AM1/25/10
to hexid, Chromium-extensions
hexid,
your code should work in the background.html as well. There must be an
issue in the rest of the code you have in the js. We'd need to see the
other files of your test extension to find out where it is.

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

Reply all
Reply to author
Forward
0 new messages