开发者

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 m开发者_JAVA百科odified 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!


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" />


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜