We help IT Professionals succeed at work.
Get Started

Display a section of an iFrame only

jhonc66
jhonc66 asked
on
788 Views
Last Modified: 2017-11-08
Hi, I am using the following code in order to display and parse a search query.

$(document).ready(function () {
  
           
            url = window.location.href;
            var querystring = url.split("?")[1]; //GuessID=123&someother=123
            var targeurl = "http://old.racingnsw.com.au/default.aspx?s=search-wp&" + querystring;
            var $iframe = $('#horse-name-search-iframe');
            if ($iframe.length) {

                $iframe.attr('src', targeurl);
              $('#horse_name_searchid').load('http://old.racingnsw.com.au/default.aspx?s=search-wp #ctl06_Container');

                return false;
            }
            return true;
  
});

Open in new window


but when loaded, it is loading the iframe as a whole giving me a pge within a page.
how can I target only the inside content, so that no footer or header is displayed. i am trying to hide the top through css but that is not ideal, therefore I wought of a javascript solution

<div id="horse_name_searchid" class="horse_name_search1" style="overflow: hidden; height: 703px;">
<iframe id="horse-name-search-iframe" src="http://old.racingnsw.com.au/default.aspx?s=search" style="margin-top: -260px;"  width="100%" height="1000" frameborder="0" ></iframe>
</div>

Open in new window

display-only.png
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2020
Most Valuable Expert 2018
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE