2011-08-03 4 views
1

내 페이지 중 하나에 Google News Box을 첨부했습니다.Google 뉴스 박스, 새 창에서 열기 뉴스 페이지/Tab

방문자가 뉴스를 클릭하면 내 사이트를 떠나 뉴스 사이트로 이동합니다.

target="_blank"을 어딘가에 삽입하여 뉴스가 새 창/탭에로드 될 수 있는지 궁금합니다.

참고 : 링크는 Google의 iframe 안에 있습니다. 그래서 iframe을 가져 오는 동안 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); 
         } 

답변

0

를 사용하여 아래의 코드는 documentation google.search.Search.LINK_TARGET_BLANK에서 찾을 수 있습니다.

필요한 것이 있습니다. 코드를 넣으면 예제를 더 쉽게 얻을 수 있습니다.

편집을 할

그것은 좀 지저분하지만 그래서 구글 않습니다

here :

페이지 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 (구글) :

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

당신이 API 방식을 통해 반대 그렇게하는 예를 제공 될까요 사용중인 iframe에 (편집 된 질문) – Will

+0

다른 iframe 안에 Google iframe을 호출하십시오. Google과 마찬가지로. –

+0

코드를 제공해 주셔서 감사합니다. 나는 그것이 찾고있는 몇 가지 추가 기능을 가지고 apis (질문에 편집)와 함께 결국,하지만 당신의 대답은 거의 잘 작동합니다. – Will

0

구글 포기 " 뉴스 쇼 ". 오랫동안 사용되지 않았지만 몇 주 전에 뉴스 쇼가 막 중단되었습니다. 나는 내 사이트를 대신 할 수 밖에 없었다. 여기

는 여러 가지면에서 더 나은 Google 뉴스 RSS 교체입니다 : (. BTW, 뉴스 기사의 링크가 자동으로 새 탭/창에서 열립니다)

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

참조 이 포럼 스레드 :

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