Jump to content

Embed div with known ID on another site

lubblig
Go to solution Solved by Toxicable,

There are loads of free to use Weather API's that you could get this data from and display it your own way, might be a bit more work but would be better than just using someone else's webpage

So I'm trying to build a website (for myself only, I won't be publishing it anywhere) and I want to embed a div from a weather site that contains the next five days of weather, but only that div (which has a known id), I do not want the rest of the website.

 

What I've tried so far is to use an iframe and link to the website and then add #weatherDivIWant at the end of the url, but I'm unable to get it to work. Probably because it doesn't work like that because it doesn't work in my browser either, it just links to the main site anyway...

 

But basically what I want is to be able to get just the contents of a div from another website and display it in a div/iframe on the site I'm building. How would I go about doing that?

 

Thanks

Spoiler

System:

i5 3570k @ 4.4 GHz, MSI Z77A-G43, Dominator Platinum 1600MHz 16GB (2x8GB), EVGA GTX 980ti 6GB, CM HAF XM, Samsung 850 Pro 256GB + Some WD Red HDD, Corsair RM850 80+ Gold, Asus Xonar Essence STX, Windows 10 Pro 64bit

PCPP:

http://pcpartpicker.com/p/znZqcf

 

Link to comment
Share on other sites

Link to post
Share on other sites

Guide: DSLR or Video camera?, Guide: Film/Photo makers' useful resources, Guide: Lenses, a quick primer

Nikon D4, Nikon D800E, Fuji X-E2, Canon G16, Gopro Hero 3+, iPhone 5s. Hasselblad 500C/M, Sony PXW-FS7

ICT Consultant, Photographer, Video producer, Scuba diver and underwater explorer, Nature & humanitarian documentary producer

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, ALwin said:

Thanks, I'll give it a try!

Spoiler

System:

i5 3570k @ 4.4 GHz, MSI Z77A-G43, Dominator Platinum 1600MHz 16GB (2x8GB), EVGA GTX 980ti 6GB, CM HAF XM, Samsung 850 Pro 256GB + Some WD Red HDD, Corsair RM850 80+ Gold, Asus Xonar Essence STX, Windows 10 Pro 64bit

PCPP:

http://pcpartpicker.com/p/znZqcf

 

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, ALwin said:

ew iframes. Though that probably is the easiest way.

 

i believe you can use JavaScript to get data from inside tags.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, vorticalbox said:

ew iframes. Though that probably is the easiest way.

 

i believe you can use JavaScript to get data from inside tags.

Well they talk about PHP and JavaScript solutions there too.  The best solution is for the target website to serve the information in the form of a service, otherwise it steps into a grey area if you try to take information like that from another site without their permission or knowledge.

 

An example is YouTube that offers an embed code that can be put in any other website.  The embed code they provide is a service that displays the embedded video on a third party site.

Guide: DSLR or Video camera?, Guide: Film/Photo makers' useful resources, Guide: Lenses, a quick primer

Nikon D4, Nikon D800E, Fuji X-E2, Canon G16, Gopro Hero 3+, iPhone 5s. Hasselblad 500C/M, Sony PXW-FS7

ICT Consultant, Photographer, Video producer, Scuba diver and underwater explorer, Nature & humanitarian documentary producer

Link to comment
Share on other sites

Link to post
Share on other sites

There are loads of free to use Weather API's that you could get this data from and display it your own way, might be a bit more work but would be better than just using someone else's webpage

Link to comment
Share on other sites

Link to post
Share on other sites

19 hours ago, Toxicable said:

There are loads of free to use Weather API's that you could get this data from and display it your own way, might be a bit more work but would be better than just using someone else's webpage

This is what I ended up doing, was way easier than I thought, found a great little API that could retrieve weather information and it looks way better than just embedding part of someone else's website. Thanks!

Spoiler

System:

i5 3570k @ 4.4 GHz, MSI Z77A-G43, Dominator Platinum 1600MHz 16GB (2x8GB), EVGA GTX 980ti 6GB, CM HAF XM, Samsung 850 Pro 256GB + Some WD Red HDD, Corsair RM850 80+ Gold, Asus Xonar Essence STX, Windows 10 Pro 64bit

PCPP:

http://pcpartpicker.com/p/znZqcf

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×