谷歌新闻框,在新窗口/标签中打开新闻页面

Google News Box, Open News Page in New Window/Tab

本文关键字:新闻 标签 窗口 新窗口 谷歌      更新时间:2023-09-26

我在我的一个页面上附加了一个Google新闻框。

现在,如果访问者点击新闻,他们会离开我的网站,去新闻网站。

我想知道是否有可能在某个地方插入target="_blank",以便在新窗口/选项卡中加载新闻。

注意:该链接位于google的iframe内。所以我在想,如果我能以某种方式创建在谷歌iframe的顶部点击事件,同时抓住它的url。

<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.search.Search.LINK_TARGET_BLANK.

这正是你所需要的。如果你把你的代码给一个例子会更容易。

编辑

有点乱,但是google在这里也是:

页面:

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

Page 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>

谷歌放弃"newsshow"。它已经被弃用了很长一段时间,但几周前新闻节目刚刚停止工作。我不得不匆忙地建立一个替代我的网站。

这是一个在很多方面都更好的Google新闻RSS替代品:

http://www.gooplusplus.com/news-frame-guide.html

(顺便说一句,新闻故事的链接会在新的选项卡/窗口中自动打开。)

查看此论坛主题:

http://hypercube.us/forum/index.php?topic=1501.0