0

Currently I use iFrame to display third party content. For example, my news page displays live website from CNN, MSNBC, Foxnews in single page.

Currently, I am just using iFrame to display those sites, but I was wondering if there is a better way to display the contents using Javascript, jQuery or other type of Javascript library?

Thanks

[edit] Is there a way I can compress the iframe and display it as a thumbnails without converting it to an image. Just shrink everything.

1
  • 1
    Regarding your edit. That is a whole other can of worms. I suggest you ask that as a new question. Commented Oct 12, 2010 at 16:20

5 Answers 5

2

Currently, I am just using iFrame to display those sites, but I was wondering if there is a better way to display the contents using Javascript, jQuery or other type of Javascript library?

Hardly. You won't be able to fetch the content directly due to the Single Origin policy; and even if you were using a server-side proxy to circumvent this, every page is bound to be using a plethora of JS code incompatible with the others.

Having them all in separate iframed documents is the only way to go.

Sign up to request clarification or add additional context in comments.

5 Comments

Provided those sites are written in clean semantic (X)HTML, you could at get the plain documents, parse the HTML, and assemble a suitable representation for your site. You'll lose all the style and script contained in the websites you're displaying, which may or may not be what you want.
@tdammers You still have to take the same origin policy under consideration
Is there a way I can compress the iframe and display it as a thumbnails?
@Josh: Pekka already suggested a server-side proxy, which is probably a good idea anyway since you're going to have a lot of processing to do to assemble the result.
@Mark: This is even harder. You'd have to render full pages somewhere, convert them into an image, resize that, and send it to the client. There should be tools to do it, but it's almost certainly going to be server side.
1

Due to the same origin policy, using iframes is necessary in this case. That is, unless of course you are writing something that simply runs on your local machine (as opposed to coming from a remote web server), then you can do whatever you want, such as loading the page with jQuery.get.

1 Comment

I wrote an HTML page that sits on my desktop that loads the local newspaper web site into a DIV, after removing all the pesky Flash ads ;)
1

Maybe you could use YQL.

Comments

0

Maybe those pages have rss? Then you can hook on to that, for instance using Google Feed API 2.

Comments

0

A lot of services offer JSON and JSONp apis that you can hook into. (I'd Google around for the docs) And once you have the data there are a number of JavaScript template libraries that you can use to insert the JSON data into the page: HTMLBuilder, PURE, Mustache, &c.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.