Embed Code Inquiry

Is it possible to only embed a certain portion of an external webpage? Say there is a certain section on page and I only want to embed that section, not the whole page, how would I go about doing so?

iframe if from external domain, jQuery.load() if same domain.

1 Like

iframe will let me grab only a certain section? Not the whole page?

Would something like this work?

What would i make the link if im only trying to pull one individual section @samliew ?

Thank you for the quick response! :slight_smile:

<iframe src="link here" height="1300" frameborder="0" width="100%" scrolling="yes" overflow-y="hidden"></iframe>

Oh, if only a certain portion of the page, you will have to write PHP or some server-side code as a proxy to fetch and parse and return only the portion you want.

Otherwise, it’s best to liaise with the site to get them to create a partial page for you to iframe.

In short, if you don’t own the page, JavaScript is unable to do it due to security sandboxing.

1 Like

Sorry, what I meant was, no easy way to do it because it is disabled by default.

Here is what you need if you want to do a cross-site scripting:

javascript - Loading cross-domain endpoint with AJAX - Stack Overflow
How to load cross domain html using jQuery - Stack Overflow

(note that you may still need to do some kind of server hacking)

1 Like