[英]Google News Box, Open News Page in New Window/Tab
我在其中一個頁面上附加了Google新聞框 。
現在,如果訪客單擊新聞,他們將離開我的站點並轉到新聞站點。
我想知道是否有可能在某處插入target="_blank"
,以便將新聞加載到新窗口/標簽中。
注意:鏈接位於Google iframe中。 所以我在想如果我能以某種方式在抓取它的URL的同時在google iframe的頂部創建on-click事件。
<iframe frameborder=0 marginwidth=0 marginheight=0 border=0
style="border:0;margin:0;width:928px;height:100px;"
src="http://www.google.com/uds/modules/elements/newsshow/iframe.html?
rsz=large&format=728x90&q=Internet%20Retailng%20Aus&element=true" scrolling="no"
allowtransparency="true"></iframe>
解:
1:請參閱ALFRO的答案。
2:以下使用api的代碼
google.load("elements", "1", {packages : ["newsshow"]});
function onLoad() {
var options = {
"linkTarget" : "_blank"
}
var content = document.getElementById('news');
var newsShow = new google.elements.NewsShow(content,options);
}
谷歌放棄了“新聞節目”。 它已被棄用很長時間,但幾周前新聞節目才停止工作。 我不得不爭先恐后地為我的網站建造一個替代品。
這是Google新聞RSS替代品,在許多方面都更好:
http://www.gooplusplus.com/news-frame-guide.html
(順便說一句,新聞報道中的鏈接會在新標簽頁/窗口中自動打開。)
查看此論壇主題:
在文檔 google.search.Search.LINK_TARGET_BLANK中找到。
這就是你所需要的。 如果您輸入代碼,將更容易舉一個例子。
已編輯
有點混亂,但是Google 在這里 :
頁面A:
<head>...</head>
<body style="font-family: Arial;border: 0 none;">
<iframe height="90px" width="728px" frameborder="0" marginheight=0 marginwidth=0 scrolling="no" src="pageB.html"></iframe>
</body>
網頁B(google):
<iframe height="90px" width="728px" frameborder="0" marginheight=0 marginwidth=0 scrolling="no" src="http://www.google.com/uds/modules/elements/newsshow/iframe.html?rsz=small&q=Foreclosure,Mortgage Refinance&format=728x90"></iframe>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.