繁体   English   中英

iframe中的自动重定向问题

[英]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&amp;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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM