Internal IFrame?

A

Anze

Hi all!

I'm trying to find a way to embed a document inside a document, but without
using external HTML files. I need something like this:

<html>
....
<something_like_iframe>
<html>
<head>
<link rel="stylesheet" type="text/css"
href="http://www.xyz.com/style_2.css" />
</head>
<body>
...
</body>
</html>
</something_like_iframe>
....
</html>

Why? Because of the way I am generating the page (from PHP) I would like the
page to be in one document, but I would still like the part inside
'<something_like_iframe>' to use other stylesheet than the main document.
Is this possible? Using JS maybe?

It is on admin pages, so I know the users will have up-to-date browsers.

Any idea would be appreciated...

Anze
 
N

Neredbojias

With neither quill nor qualm, Anze quothed:
Hi all!

I'm trying to find a way to embed a document inside a document, but without
using external HTML files. I need something like this:

<html>
...
<something_like_iframe>
<html>
<head>
<link rel="stylesheet" type="text/css"
href="http://www.xyz.com/style_2.css" />
</head>
<body>
...
</body>
</html>
</something_like_iframe>
...
</html>

Why? Because of the way I am generating the page (from PHP) I would like the
page to be in one document, but I would still like the part inside
'<something_like_iframe>' to use other stylesheet than the main document.
Is this possible? Using JS maybe?

It is on admin pages, so I know the users will have up-to-date browsers.

Any idea would be appreciated...

Anze

You ought to step back and re-evaluate your approach.
 
T

Travis Newbury

Anze said:
I'm trying to find a way to embed a document inside a document, but without
using external HTML files. I need something like this:

If you want "something like an iframe" why not just use an iframe? You
did say that you have control over the users browsers so it shouwl nt
be an issue.

Or why not just use PHP(asp, etc...)
 
A

Anze

If you want "something like an iframe" why not just use an iframe? You
did say that you have control over the users browsers so it shouwl nt
be an issue.

With iFrame you have to create another document which is a bit difficult for
me to do in this case. It is possible, but I would like to find another
solution.
Or why not just use PHP(asp, etc...)
How do you mean that? I am using PHP, but I need a way to express the data
in HTML format.

Thank you!

Anze
 
A

Anze

You ought to step back and re-evaluate your approach.

From the users' point of view this approach is very elegant so I wouldn't
like to change it. But I will if I have to, of course...
I'm building a newsletter. The users must have the option to review the mail
before it is sent out and it would be perfect if the HTML they preview is
completely identical to HTML that is being sent over e-mail (less chance
for error - people tend to be sensitive if they get ugly e-mails ;). The
only problem is that the page itself already has the CSS stylesheet - which
is different from what the newsletter HTML uses. So, iFrame would be ideal,
except that I have to feed it the content and not the name of the file that
serves the content (there is no such file and it would be difficult to
write one).

Is there some other way to display the content (whole HTML) inside the page
so it is completely independent of the main HTML page?

Right now I am using popup + document.write to achieve this, but it's a bit
cumbersome for usage...

Thank you!

Regards,

Anze
 
N

Neredbojias

With neither quill nor qualm, Anze quothed:
With iFrame you have to create another document which is a bit difficult for
me to do in this case. It is possible, but I would like to find another
solution.

How do you mean that? I am using PHP, but I need a way to express the data
in HTML format.

I thought that was the problem? Anyway, you could use php to
selectively alter or remove those parts of the "data" that need to be
adjusted before output. For instance, you could remove all the
superfluous tags and their content. As for the css, that's what
"class" was made for and you could even id certain elements if
necessary. If this "data" is initially formatted as a complete html
document, however, (-which I'm still not sure of), I'd probably write-
out another file (via php) and address that.
 
A

Anze

I thought that was the problem? Anyway, you could use php to
selectively alter or remove those parts of the "data" that need to be
adjusted before output. For instance, you could remove all the
superfluous tags and their content. As for the css, that's what
"class" was made for and you could even id certain elements if
necessary. If this "data" is initially formatted as a complete html
document, however, (-which I'm still not sure of), I'd probably write-
out another file (via php) and address that.

OK, it seems I wasn't clear enough. :)

Yes, this is exactly the case - I have data, which is formatted as a
complete HTML document, that I want to display inside a document. I would
hate to write to another file though - there are privacy issues with that.
I could write another PHP that would serve just this content (and use
IFRAME to address it) - but it is a bit complicated for me to do so because
there are lots of checks involved.

Right now I output JavaScript code that prints this document as a popup, but
this is a bit annoying for a user - I would rather have this in a box
inside the current document.

Is there some way I can set IFRAME's contents via JavaScript? I tried using
innerHtml but it doesn't work with FireFox. Is there some other function I
could use?

Kind regards,

Anze
 
N

Neredbojias

With neither quill nor qualm, Anze quothed:
OK, it seems I wasn't clear enough. :)

Yes, this is exactly the case - I have data, which is formatted as a
complete HTML document, that I want to display inside a document. I would
hate to write to another file though - there are privacy issues with that.
I could write another PHP that would serve just this content (and use
IFRAME to address it) - but it is a bit complicated for me to do so because
there are lots of checks involved.

Right now I output JavaScript code that prints this document as a popup, but
this is a bit annoying for a user - I would rather have this in a box
inside the current document.

Is there some way I can set IFRAME's contents via JavaScript? I tried using
innerHtml but it doesn't work with FireFox. Is there some other function I
could use?

Yes. You could try "nodeValue" but you'll have to research it via the
w3c or et al because I'm not all that familiar with it. However, inner
HTML usually works fine in ff, but maybe crossing the iframe "boundary"
is a prob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top