Load external webpage into div

2019-09-07 03:57发布

问题:

I have been reading about iframe, jquery, jsonp and what not how to come up with a solution to my "problem".

I am wondering, what is the best approach to get the result I need?

Any and ALL help with this is greatly appreciated! Suggestion code/script/strings is prefered, I have never tried something like this before.

Scenario:

  • Load/display external URL/webpage from external.com/loadme.html to domain.com/loaded.html
  • Possible to navigate (click links) in the loaded/iframed output

I am wondering, how should I go about making the external.com/loadme.html?

  • using ajax for navigation and loading content into the loadme.html?
  • Regular navigation links?

Basicly, I am going to make a page with some content, a couple of links and what not, and load the whole thing to 2 other websites with navigation and all, inside a DIV.

I am not sure what would be the best way to do this, and before I use alot of time researching this, I wanted to ask if someone have any suggestions?

Thanks!! -Tom

回答1:

What is wrong with an iframe? It does all of this work for you.



回答2:

If this is across multiple domains, you will more than likely need to use iFrames anyways.