2

I am trying to design a web application. Because of the way I am doing it, it is difficult to put all of the information onto one page (multiple database look-ups). I have created a proto-type that uses iframes: one for <nav> one for <aside>, one for the main bit, etc. It can not format the iframes, as I want them (sizing). Apparently, iframes can't do what I want.

Is there a way to get the same affect: What seems to be a single web-page, but in reality a composite of many.

Solutions that I have considered:

  • I am doing iframes wrong: tell me how to do them correct.
  • I should be using a different tag: tell me which.
  • Use a compositing reverse-proxy on server (maybe converts iframes to in-line html).
  • Do compositing using javascript, on client (I have been trying to avoid javascript on most pages, as it is sometimes disabled, for security reasons.)
  • xslt, on client: I just thought of this when writing previous bullet point, and have no idea, yet, if it can do it.

I have tried the first 2, and can not find anything about the 3rd.


I am using couchdb, I do not want to include to much into each view as it will trigger cache invalidation for the whole page, if something changes. Because of filter ranges, I think this will happen even if it is data that is not relevant for the page.

1
  • 1
    You do not define multiple database look-ups. This means that we have to guess. Are these two different database engines? Are these two database schema? Are these two different tables from a schema? Each requires a different answer. For example, I do not know couchdb, however, using mySQL and even with another database, it is very possible to query one database, create a table in the other database with the results, create a relation optionally, then query against both data sets. Remember that using RDBMS almost anything is possible. Cheers!!
    – closetnoc
    Feb 14, 2017 at 1:45

2 Answers 2

1

Just because you are pulling data from multiple databases doesn't mean you have to use iframes or anything like that.

Create an object for each data set and included them in the page using DIVs as you would if you were using a single database.

I think you are making it more complicated that the project needs to be.

3
  • You did not answer the question, you just restated the premise of the question. Feb 13, 2017 at 10:16
  • You asked "Is there a way to get the same affect: What seems to be a single web-page, but in reality a composite of many." Using multiple databases in a single web page without iframes is trivial. It is not "a composite of many pages", it is a single page with multiple data sources.
    – Steve
    Feb 13, 2017 at 10:38
  • “What seems to be a single web-page, but in reality a composite of many.” Feb 13, 2017 at 10:47
0

IFrames are a messy method of importing content from one page into another which are used far to frequently for the wrong reasons in my opinion.

For what you are wanting to achieve here you would be better off building the page using AJAX.

What you would do is define the basic page structure with <div></div> tags named for the specific parts of the page they handle. At the end of the page load you would run a series of parallel AJAX requests back to the server to get this data from the various pages on the server that the data comes from and then populate the div's with that AJAX obtained content. By doing this effectively all the content resides on the same page within the document object model and can be worked on as if it all was sent to the browser as a single page to begin with.

NB: I do this quite frequently with web applications that I write where data from multiple disparate sub systems (within the same web server) is being pulled onto one page. For simplicity sake I called it "pagelets" and did it as a jQuery loop where I go through the page and for each div I gave a .pagelet class to I attached a on page ready event to run and do an AJAX fetch to fill the <div> with the contents of the page (where the link was defined in the div as a data-url attribute).

2
  • I have been trying to avoid javascript, on most pages, as it is sometimes disabled. However I have used it on some pages. Mainly been a split between editing pages have javascript, non-editing pages don't. I still like this idea though, and will keep it as a backup. Feb 13, 2017 at 10:08
  • I'd check the actual metrics for JS usage among your users. Most modern sites require JS, so I expect they'd be pretty high. Feb 15, 2017 at 14:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.