views:

171

answers:

3

I want to have a link in the popup.html file for my extension that loads another file (which will be included with the extension) how can I do this? or will I need to keep it in the same page?

I tried using this code:

<a href="/mail.html">
    <img id="newmail_icon" src="" width="16" height="16" />
    <span id="newmail">loading</span><br />
</a>

But when I click the link nothing happens.

I just found out that adding target="_blank" to the link will make it work and open in a new tab, but I can't get it to open in the popup. I have tried target="_self" but it didn't do anything.

A: 

You can reference the file /my_new_file.html

Where my_new_file is in the root of your directory.

Revolution42
I tried that before I posted the question but when I click the link nothing happens.
Hintswen
Yeah sorry, I was doing this in another page (not the popup) and it worked. You could create an iframe for your popup. Not ideal but might solve your problem.
Revolution42
+1  A: 

The API you are looking for is chrome.extension.getURL.

Scott Wolchok
A: 

ok chrome.extension.getURL but i don't know use it. For example ..

button type="button" class="dcbtn" onClick=chrome.extension.getURL("file.html");

??

Gnu