jianinz
jianinz

Reputation: 163

Chrome extension popup page link doesn't work

I was creating a Chrome extension for fun, but i got a problem with my popup page. I used jQuery load() function to load a part of existed page, let's say: http://aaa.com:

<div id="aaa-news">
$(document).ready(function(){
     $("#ox-news").load("http://aaa/News/ .news_list");
});
</div>

Since the part of page i tried to load into popup.html contains some links, but seems href attributes of these links have been modified by Chrome whenever they are loaded in popup.html.So even if i used chrome.tabs.create.* API to open a new tab, it always showed me

No webpage was found for the web address: Chrome extension://phigdpgmolbpdcihdohfpbafibncbkhl/News/1 Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.

Anyone has idea? Appreciated for your help!

Upvotes: 4

Views: 8471

Answers (2)

user2543963
user2543963

Reputation: 1

I had the same problem, and solved it by using the following chrome extension :

New Tab Redirect! 2.0

https://chrome.google.com/webstore/detail/icpgjfneehieebagbmdbhnlpiopdcmna

Click the original chrome pages "New Tab" button on the tab that appears the after installation of this extension.

Upvotes: 0

serg
serg

Reputation: 111265

To fix relative links you can use <base> tag. It is also useful to make all links inside popup to open in a tab by setting target="_blank" (otherwise links become non-clickable):

<base href="http://aaa/" />
<base target="_blank" />

Upvotes: 7

Related Questions