mane
mane

Reputation: 11

How to offer a webapp to other sites. (div with javascript, iframe or..?)

I am quite new to web application development and I need to know how would I make other sites use it.

My webapp basically gets a username and returns some data from my DB. This should be visible from other websites.

My options are:

There must be better ways to integrate web applications than what I'm thinking. Could someone give me some advice?

Thanks

Upvotes: 1

Views: 292

Answers (3)

tinyd
tinyd

Reputation: 952

If what you really want is to expose the data, but not the visual content, then I'd consider exposing your data via JSONP. There are caveats to this approach, but it could work for you. There was an answer here a couple of days ago about using a Web Service, but this won't work directly from the client because of the browser's Same Origin policy. It's a shame that the poster of that answer deleted it rather than leave it here as he inadvertently highlighted some of the misconceptions about how browsers access remote content.

Upvotes: 0

M.L.
M.L.

Reputation: 4706

Context Framework contains embedded mode support, where page components can be injected to other pages via Javascript. It does depend on jQuery but it can always be used in noConflict-mode. At current release the embedded pages must be on same domain so that same-origin-policy is not violated.

In the next release, embedded mode can be extended to use JSONP which enables embedding pages everywhere.

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114377

Iframes cannot communicate with pages that are on a different domain. If you want to inject content into someone else's page and still be able to interact with that page you need to include (or append) a JavaScript tag (that points to your code) to the hosting page, then use JavaScript to write your content into the hosting page.

Upvotes: 1

Related Questions