내 페이지 중 하나에 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
다음 apigoogle.load("elements", "1", {packages : ["newsshow"]});
function onLoad() {
var options = {
"linkTarget" : "_blank"
}
var content = document.getElementById('news');
var newsShow = new google.elements.NewsShow(content,options);
}
당신이 API 방식을 통해 반대 그렇게하는 예를 제공 될까요 사용중인 iframe에 (편집 된 질문) – Will
다른 iframe 안에 Google iframe을 호출하십시오. Google과 마찬가지로. –
코드를 제공해 주셔서 감사합니다. 나는 그것이 찾고있는 몇 가지 추가 기능을 가지고 apis (질문에 편집)와 함께 결국,하지만 당신의 대답은 거의 잘 작동합니다. – Will