Skip to content Skip to sidebar Skip to footer

Display The Content Of A Div On Another Webpage In My Website

I would like to display the content of a particular div element on a 3rd party website on my website, using JavaScript. I know the id of the div element I want to display. Can this

Solution 1:

You can't do this with Javascript.

You have to download the page using a script on your server (using something like PHP), then use that downloaded data to look through its DOM, and then select the element you want.

Javascript only works on the current page showing in a browser, it can't (shouldn't) talk to other websites.

Solution 2:

If you want to display a website in your own website then you can use iframe for that.

<divid="help"><iframesrc="http://www.codeforbrowser.com"height="500px;width="600px;"></iframe></div>

Solution 3:

this could be possible though no trecomended:

you can load the external site into an iframe and then access the loaded frame specific element to get the value of the div you want and then putting it into your own div

Post a Comment for "Display The Content Of A Div On Another Webpage In My Website"