1

I'd like to find the best solution for loading external content (from php script, external website) in a div with javascript code (no jQuery, Mootools or any other lib, just pure JS). It must work in any browser, even IE :) What is the best way to achieve this?

I found lots of posts about this, but a lot of them where old, or with no certain solution. Or is it better to achieve this with iframe?

Nelson
  • 49,283
  • 8
  • 68
  • 81
Martin
  • 11
  • 1
  • 6
    If you want a good cross-browser solution, and you don't want to use jQuery or some other framework, you're making it very hard for yourself. – Philippe Leybaert Sep 30 '12 at 20:52
  • You can try use native XMLHttpRequest. Here are some tutorials on how make ajax call with native object: http://www.cristiandarie.ro/asp-ajax/Async.html, http://blog.sociomantic.com/2010/08/native-javascript-ninjutsu-ajax-with-xhr/ – Zefiryn Sep 30 '12 at 20:53
  • Yes I know, but there is no way I can use any framework. It needs to work on every website even without frameworks. It based on the idea that user copy/paste the code into his website and after every load website loads content from external source. – Martin Sep 30 '12 at 20:57
  • OK, XMLHttpRequest is fine, but how to handle IE browsers with ActiveX turned off? – Martin Sep 30 '12 at 20:59
  • @MartinMalych - IE7 and above uses a native XMLHttpRequest object, so you don't need ActiveX enabled. – FixMaker Oct 01 '12 at 10:39
  • helpful link for u: http://stackoverflow.com/questions/1452871/how-can-i-access-iframe-elements-with-javascript – Darius Miliauskas Apr 13 '15 at 23:44

0 Answers0