【问题标题】:Why the iframe link not showing为什么 iframe 链接不显示
【发布时间】:2020-01-16 14:39:39
【问题描述】:

当我从谷歌复制并粘贴链接时,它会改变(不知道为什么会改变)并显示结果。但我不明白为什么它不显示现有链接的结果。

div.sidebar {
  float: right;
  border: 10px #0000ee;
  width: 30%;
  font-size: small;
  padding: 10px 10px 10px 10px;
  background-color: #CCCCFF;
  font-face: times;
  color: #660099;
  text-align: left;
}

.sbarTitle {
  float: center;
  font-family: Georgia, Palatino, Times, serif;
  font-size: 115%;
  color: #660099;
  font-weight: bold;
  line-height: 150%;
}
<div class="sidebar">
  <span class="sbarTitle">NOTE: </span> For a much more detailed exploration of this idea, please see my piece,<i> Soul Friends: A Wiccan / 
    Jesus-Based Spirituality</i>, in the book:
  <p></p> <br>
  <TABLE align="left" width="130">
    <TR>
      <TD>
        <iframe src="https://rcm.amazon.com/e/cm? 
    lt1=_blank&bc1=FFFFFF&IS2=1&nou=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=gointhbe- 
    20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins=0738721913" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
      </TD>
    </TR>
  </TABLE>
</div>

【问题讨论】:

    标签: html css iframe


    【解决方案1】:

    尝试使用 jquery get 加载 iframe 内容,代码如下:

    $.get("https://rcm.amazon.com/e/cm?lt1=_blank&bc1=FFFFFF&IS2=1&nou=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=gointhbe-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins=0738721913", function (response){ 
    var html = response;
    var html_src = 'data:text/html;charset=utf-8,' + html;
    $("#iframeId").attr("src" , html_src);
    });
    div.sidebar{
    float: right;
    border: 10px #0000ee;
    width: 30%;
    font-size: small;
    padding: 10px 10px 10px 10px;
    background-color: #CCCCFF;
    color: #660099;
    text-align: left;}
    
    .sbarTitle {float: center; font-family: Georgia, Palatino, Times, serif; font-size:115%; color: 
    #660099; font-weight: bold; line-height: 150%;}
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <div class="sidebar">
    <span class="sbarTitle">NOTE: </span> 
    For a much more detailed exploration of this idea, please see my piece,<i> Soul Friends: A Wiccan / 
    Jesus-Based Spirituality</i>, in the book: 
    <p></p>  <br> 
    <TABLE align="left" width="130">
    <TR>
    <TD>
    <iframe id="iframeId" style="width:120px;height:240px;" 
    scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
    </TD>
    </TR>
    </TABLE>
    </div>

    【讨论】:

    • 感谢您的回复。主要问题是我只能通过 HTML 和 CSS 来做到这一点。在 "sitesell CMS" 中没有使用 JS 或 Jquary 的选项。有可能吗?
    • 当然,但我不知道为什么它不适用于您的链接,这就是我建议使用 jquery 的原因
    猜你喜欢
    • 2022-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 1970-01-01
    • 2013-03-16
    • 1970-01-01
    相关资源
    最近更新 更多