chetan patel
chetan patel

Reputation: 606

how to load part of webpage in iframe?

i want to show part of a webpage in iframe. i have tried jquery to hide header and footer and to show content part only but not working. i have tried to apply CSS but not applied as the webpage comes from another website.

i just want to remove header and footer section using jquery or CSS if possible.

this is the code i am trying:

<iframe src="http://schweizer.deco-apparel.com/create_products/Ultra-Cotton-100-Cotton-T-Shirt?n=9465742" height="500px" width="100%" ></iframe>

here is link to this code: http://jsfiddle.net/chetan17/gxth1b12/

is there any way to hide div with id header and id footer section?

Thanks

Upvotes: 0

Views: 4154

Answers (2)

ACarlson1994
ACarlson1994

Reputation: 71

The only ways to hide the header and footer is if you could change the code on the site you are referencing in your iFrame tag OR if the iFrame is on a page within the same domain as the page you are referencing in the iFrame you can use jQuery to edit within the iFrame.

You would use either the backend of the site or your JavaScript/jQuery to detect if there is a parameter in your iFrames link(ie. www.blah.com/blah?hide=true), which will hide the footer and header if hide=true.

Upvotes: 0

Francois
Francois

Reputation: 10968

If the frame is displaying data from another website (ie. hosted on another domain), there is no way to do this, due to cross domain security enforced by your browser.

--> jQuery cross domain iframe scripting

If the frame is displayed from another webpage hosted on http://schweizer.deco-apparel.com, use jQuery to manipulate DOM content of iframe.

--> Change HTML of an iFrame with jQuery?

Upvotes: 1

Related Questions