开发者

jQuery Load an external script rich PHP file into local page

I've searched the entire web for a clear answer but haven't found one yet.

I have this site:

www.helixagent.com/todo/

and I want to load that entire site into a portlet in my main index page.

I tried an iFrame approach but it fails to load the site correctly. The styles and javascript files don't get loaded (i think)

Is there a way to make a portal that mimics a new br开发者_如何学运维owser page and load the content exactly as it would if it was directly accessed via the url bar?


It’s possible to perform cross-domain requests using jQuery.

Simply include this file after loading jQuery, and then you can do funky stuff like:

$('html').load('http://helixagent.com/todo/');

Note that this of course won’t load the embedded CSS and JS files. You’ll need to use an iframe for that:

$(function() {
 $('body').append('<iframe src="http://www.helixagent.com/todo/" />');
});

Live example: http://jsbin.com/uruka


Here's an example using jQuery and iframe:

$(document).ready(function(){
    $('#somediv').html("<iframe src='http://www.helixagent.com/todo/'></iframe>");
});

This should be placed inside the <head> tag of your page and it will load the entire site with all the js and css too into a div.


Have you looked at using Server Side Includes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜