images.google.com과 유사한 막대를 어떻게 렌더링합니까?
-
05-07-2019 - |
문제
어떻게 images.google.com 프레임을 렌더링합니까 ??
외부 웹에서 볼 수있는 컨텐츠가있는 서버와 관리자 만 사용할 수있는 내부 검색 엔진이 있습니다. 외부 컨텐츠는 편집 할 수 없으며 일부 독점 기술로 작성되었습니다. 내가하고 싶은 것은 내부 관리자가 images.google.com Appends와 같은 페이지 하단에 "관리 막대"를 페이지 하단에 추가하여 외부 사이트 (인덱스)에서 관리 기능을 수행 할 수있는 막대를 볼 수 있도록 허용하는 것입니다. 웹 사이트의 시작 부분에 프레임.
아래 코드를 사용하여 두 가지가 같은 서버에있는 경우이 작업을 수행하는 방법을 알아 내고 프레임에서 외부 사이트를 렌더링하고 JavaScript로 해당 프레임을 동적으로 크기를 조정하는 방법을 알아 냈습니다. 두 개의 사이트가 다른 서버/도메인에 있습니다 (JavaScript 권한 오류가 발생 함).
상당수의 사람들이 비슷한 기능 (images.google, diggbar, facebook의 바 등)을 구현 했으므로 문제에 접근하는 방법에 대한 정보를 얻을 수는 없습니다. 모든 도움은 대단히 감사합니다
<html>
<head> <title>Parent frame</title> </head>
<body onload=”resizeFrame(document.getElementById(’childframe’))” bgcolor=”#cccccc”>
<script type=”text/javascript”>
// Firefox worked fine. Internet Explorer shows scrollbar because of frameborder
function resizeFrame(f) {
f.style.height = f.contentWindow.document.body.scrollHeight + “px”;
}
</script>
<p>Parent frame.</p>
<p>Parent frame.</p>
<p>Parent frame.</p>
<p>Parent frame.</p>
<p>
<iframe frameborder=0 border=0 src=”./child-frame.html” name=”childframe” id=”childframe”>
</iframe>
</p>
</body>
</html>
해결책
Google의 출처를보십시오!
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> Google Image Result for http://people.mozilla.com/~cbeard/labs/images/test-pilot.png
</title>
<style>
html
{
height: 100%;
}
body
{
margin: 0;
font: 62.5% arial, sans-serif;
height: 100%;
overflow: hidden;
}
a, a:visited
{
color: #00c;
}
div
{
font-size: 130%;
}
#details
{
float: left;
margin-top: 10px;
}
#details p
{
padding: 0;
margin: 0 0 2px;
}
img
{
border: none;
}
#outer-separator
{
clear: both;
width: 100%;
border-bottom: 2px solid #404040;
border-top: 1px solid #a0a0a0;
margin: 10px 0 0;
padding: 0;
font-size: 1px;
overflow: hidden;
}
#separator
{
background: #eaeaea;
height: 3px;
}
table
{
font-size: 100%;
}
</style>
</head>
<body>
<table cellpadding=0 cellspacing=0 height="100%" width="100%">
<tr height="1%">
<td style="top:0;width:100%">
<div class=std style="background:#ebeff9;padding:6px 8px">
<a href="http://images.google.com/imghp?hl=en">
<img src=/images/isr_g.png style="padding:0;margin:0;vertical-align:middle;border:0" title="Go to Google Images Home" alt="Go to Google Images Home" width=72 height=24>
</a>
<form style="display:inline" method=GET action="/images">
<input type=hidden name=gbv value="2">
<input type=hidden name=hl value="en">
<input type=hidden name=sa value="3">
<input type=text name=q size=41 maxlength=2048 value="test" title="Search images">
<input type=submit name="btnG" style="margin:0 2px 0 5px" value="Search images">
</form>
<a id=b2r href="/images?q=test&gbv=2&hl=en" onclick="if(history.length>1){history.back();return false}return true;" style="vertical-align:40%">Back to image results
</a>
</div>
<table cellpadding=0 cellspacing=0 width="100%">
<tr>
<td>
<a href="http://people.mozilla.com/~cbeard/labs/images/test-pilot.png" id=thumbnail>
<img src="http://tbn0.google.com/images?q=tbn:KLm4Rocmahp8wM:http://people.mozilla.com/~cbeard/labs/images/test-pilot.png" width=88 height=80 style="float:left;margin:10px 10px 0;border:1px solid" alt="See full size image">
</a>
<div id=details>
<p style="margin-bottom:4px">
<a href="http://people.mozilla.com/~cbeard/labs/images/test-pilot.png" style="font-size:115%;font-weight:bold">See full size image
</a>
</p>
<p>360 x 327 - 110k - png -
<span style="color:green">people.mozilla.com/.../
<wbr>images/test-pilot.png
</span>
</p>
<p>Image may be subject to copyright.
</p>
<p>Below is the image at:
<a href="http://labs.mozilla.com/tag/testpilot/">labs.mozilla.com/
<wbr>tag/testpilot/
</a>
</p>
</div>
<td align=right valign=bottom>
<div style="padding-right:8px">
<a href="http://labs.mozilla.com/tag/testpilot/" style="text-decoration:none">
<u>Remove frame
</u>
<img src=/images/isr_c.gif style="margin-bottom:-2px" height=15 width=15 alt="">
</a>
</div>
</table>
<div id=outer-separator>
<div id=separator>
</div>
</div>
<tr>
<td>
<iframe scrolling=auto id=rf src="http://labs.mozilla.com/tag/testpilot/" frameborder=0 allowtransparency=true style="width:100%;height:100%">
</iframe>
</table>
</body>
<script>var a = document.getElementById('rf');a && a.contentWindow && a.contentWindow.focus();</script>
</html>
다른 팁
이것은 일종의 재사용이지만 여기에 간다 :
- 2 행으로 테이블을 만듭니다. 한 행은 툴바가 될 것입니다. 모든 콘텐츠를 거기에 넣으십시오.
- 다른 행에 iframe을 만듭니다. iframe은 외부 사이트를 가리 려야합니다.
그래서 당신의u003Cbody> 태그에는 다음과 같은 것이 있어야합니다.
<table height="100%" width="100%">
<tr height="1%"><td>Toolbar of some sort</td></tr>
<tr><td>
<iframe scrolling=auto id=rf src="http://server/page"
frameborder=0 allowtransparency=true style="width:100%;height:100%">
</td></tr>
</table>
도구 모음의 1%는 가능한 한 작은 발자국을 갖는 것입니다. 그렇지 않으면 도구 모음은 iframe과 동일한 양을 얻습니다.
제휴하지 않습니다 StackOverflow