How exactly can I replace an iframe with a div and Javascript?

前端 未结 5 1954
再見小時候
再見小時候 2020-12-28 20:03

I have a page that loads an external HTML page into an iFrame. There are two problems I am facing with this:

  1. The iFrame is always a fixed height, but I want it
5条回答
  •  余生分开走
    2020-12-28 20:38

    You can make an ajax call to fetch your html page and add it to the div. For example using JQuery:

    $.get('yourPage.html', function(data) { $('#yourDiv').html(data); });

    Read more at: http://api.jquery.com/jQuery.get/

提交回复
热议问题