Hyperlinks don't work in Chrome browser extensions?

2,897 views
Skip to first unread message

David

unread,
Nov 1, 2010, 1:21:21 AM11/1/10
to Chromium Apps
If they do, what are limitations where they don't work? Like target =
blank, top, self, use of javascript to modify/manage link, etc.?

I was developing some extensions and noticed that the hyperlinks don't
work. My extensions are "popup" pages/actions, like the example given
in the Chrome Extension Getting Started tutorial and this is what I
observe:

* link appears as a normal hyperlink
* link seems clickable w/ mouse
* nothing happens when click valid link
* no options come up if you right-click the link

What's up with that?

FYI, here's my link

<a href="javascript:createLink();" id="linker"><span
id="linktxt">Dynamic link will be here...</span></a>

I probably should chnge the default href value but that shouldn't
matter..

I set the value with this:

function createLink()
{
document.getElementById('linker').href =
document.getElementById('thelink').value;
document.getElementById('linktxt').innerText =
document.getElementById('thelink').value;
}

This same code worked fine in my version of the extension for Apple's
Safari browser.

David

unread,
Nov 1, 2010, 12:51:39 PM11/1/10
to Chromium Apps
Forgot to mention earlier that I do set the link href value & text
later on via onclick event that calls the createLink function.

I tried using a different extension that had links too and that didn't
work either.

Arne Roomann-Kurrik

unread,
Nov 1, 2010, 2:08:02 PM11/1/10
to David, Chromium Apps
Hi David,

   In the future, extension related questions are best asked in the chromium-extensions group, but this is pretty simple so I'll answer here.  Browser and page action popup windows can't be redirected, so clicking on links doesn't have any effect.  If you want to open the link in a new browser tab, you can put target="_blank" as an attribute of the link, or attach an event listener and call chrome.tabs.create or chrome.tabs.update in response to the "click" event.

~Arne

David

unread,
Nov 3, 2010, 7:18:45 PM11/3/10
to Chromium Apps
Thanks Arne. Too many groups. Can you provide a link to the Chromium
Extensions group?

Arne Roomann-Kurrik

unread,
Nov 3, 2010, 10:21:54 PM11/3/10
to David, Chromium Apps
Reply all
Reply to author
Forward
0 new messages