[英]Automatic redirect issue in iframe
我在html頁面中有一個iframe鏈接,如下所示:
<TABLE border="0" width="900">
<tr valign="top">
<td width="300" ALIGN=center>
<div class="item_list">
<a href="http://www.skiholidayextras.com? affiliate_id=172&submit_to=http://www.skihautesavoie.fr/results-lift-pass.html" target="_blank">link</a>
</div>
</td>
<td width="300" ALIGN=center>
<div class="item_list">
<iframe src = 'http://www.flipkart.com/affiliate/displayWidget?affrid=WRID-137232779171598318' frameborder = 0, height=250, width = 300 > </iframe></a><br>
</div>
</td>
<td width="300" ALIGN=center>
<div class="item_list">
<iframe src = 'http://www.flipkart.com/affiliate/displayWidget?affrid=WRID-137232785207215857' frameborder = 0, height=250, width = 300 > </iframe>
現在,當我在iframe鏈接中單擊時,它將打開該鏈接,但是當我單擊返回時,它將自動將我重定向到該iframe鏈接。 誰能告訴我我有什么問題?
在您的情況下,我將為每個iframe實現自己的控件。 將此工作委托給頁面上的某些按鈕:
<div id="view_iframe">
<iframe id="viewer" name="viewer" width="100%" height="600" src="some.html">
<p>Your browser does not support iframes.</p>
</iframe>
<input type="button" id="back" class="button" onClick="viewer.history.back();" value="<<" />
<input type="button" id="frwrd" class="button" onClick="viewer.history.forward();" value=">>" />
</div>
注意- viewer
是iframe ID
請注意,兩個按鈕的位置都必須與頁面調整大小上的iframe對齊。
無論如何,這是iframe對此進行控制的內容:
// For an iframe's window
iframe.contentWindow.history.back();
iframe.contentWindow.history.forward();
要么
iframe.contentWindow.history.go(-1); // back
iframe.contentWindow.history.go(1); // forward
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.