473,421 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Embedded HTML in frameset - is it possible?

Is there any way to embed the HTML code inside FRAMESET? Something like
this:

<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>

I tried using a Javascript function that returns the HTML text, as in the
following code:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head> <title>Frame 1</title>
<script type="text/javascript">
function myFunction()
{
return ("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
<html>
<head>
<title>Frame 1</title>
</head>
<body>
<H2>Frame 1</H2>
</body>
</html>
")
}
</script>
</head>
<frameset cols="50%,*">
<frame src=myFunction() name="toc">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>
</html>

but the browser shows the "The page cannot be displayed" for the first
frame.

I am trying to find a way to generate a page from the Java servlet that
would contain a hidden (0-width) frame and a fully visible frame with some
dynamic content.

I will appreciate any clues.

Alex Molochnikov
Jul 23 '05 #1
14 6478
Firstly, it's usenetiquette to set a "Followup" when posting to multiple
newsgroups. [Followup set.]

Alex Molochnikov wrote:
Is there any way to embed the HTML code inside FRAMESET? Something like
this:

<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>


Many people (including myself) recommend dropping frames for CSS. Frames
have many disadvantages with no supporting advantage.

http://www.html-faq.com/htmlframes/?framesareevil

--
Ben M.
Jul 23 '05 #2


Alex Molochnikov wrote:
Is there any way to embed the HTML code inside FRAMESET?
<frameset cols="50%,*">
<frame src=myFunction() name="toc">


You can use
<frame src="javascript:parent.myFunction()" name="toc">
if you make sure that myFunction returns a string with HTML but of
course that will only work then if the browser supports JavaScript and
the user has it enabled so on the web in general that is not a good
idea, even if you want to use frames.
And even then there are issues in some browsers, Opera 7 for instance
might give you access denied errors or similar when cross frame
scripting is used later.

If you really want to set the frame content with script then it is safer
to have a function write to that frame e.g.
function initFrame () {
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write('html goes here');
frameDoc.document.close();
}

<frameset onload="initFrame();" ...>
<frame src="fallback.html" name="toc">

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3
Alex Molochnikov wrote:
Is there any way to embed the HTML code inside FRAMESET?
No.

[snip]
I am trying to find a way to generate a page from the Java servlet that
would contain a hidden (0-width) frame and a fully visible frame with some
dynamic content.


The purpose of frames (which is generally vastly outweighed by their
flaws and disadvantages) is to display content from multiple documents.
If you don't want to do that, why are you using frames at all? What is
meant to go in this "hidden" frame?
Jul 23 '05 #4
Martin Honnen wrote:


Alex Molochnikov wrote:
Is there any way to embed the HTML code inside FRAMESET? <frameset
cols="50%,*">
<frame src=myFunction() name="toc">

You can use
<frame src="javascript:parent.myFunction()" name="toc">
if you make sure that myFunction returns a string with HTML


This works?

[snip]

If you really want to set the frame content with script then it is safer
to have a function write to that frame e.g.
function initFrame () {
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write('html goes here');
frameDoc.document.close();
}

<frameset onload="initFrame();" ...>
<frame src="fallback.html" name="toc">


Well, yes, in contrast to what I said earlier, this is a way to do
it--and now you're depending on both frames AND Javascript!
Jul 23 '05 #5
Alex Molochnikov wrote:
<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>


You could use a "data:" URL, but IIRC that's only supported by Gecko and
Presto.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #6
"Harlan Messinger" <hm*******************@comcast.net> wrote in message
news:35*************@individual.net...
The purpose of frames (which is generally vastly outweighed by their
flaws and disadvantages) is to display content from multiple documents.
If you don't want to do that, why are you using frames at all? What is
meant to go in this "hidden" frame?


This is an attempt to implement a browser callback to the servlet, mostly
inspired by the Pushlets framework, as described in
http://www.javaworld.com/jw-03-2000/jw-03-pushlet.html. The hidden frame
would contain nothing, it would make a call on the servlet, and receive a
Javascript code from it. The code, in its turn, can make requests on the
servlet.

This whole thing is needed to implement a Web-based frontend for interactive
reports. The clear-view frame would initiate a request on the servlet to
generate a report. Before the request is completed (i.e. before the doPost()
or doGet() method returns), the servlet may have to get some additional info
from the user (such as the customer number for the invoice). This cannot be
done in the same frame without returning from the servlet's doGet/doPost
methods. This is where the hidden frame comes in - it will receive the
request from the servlet (a callback) to open another window with the
necessary controls (text fields, buttons etc. depending on the nature of the
additional info).

The page that issues the report request is itself dynamically generated by
the servlet. So I was trying to find a way to format it as a frameset with
the frame content coming from the servlet, in a single requset-responce
cycle (one-trip solution, if you wish). I know that the frame content in the
frameset can be set to come from the servlet, instead of an html file, but
this would require another trip to the servlet. So, I tried using the
Javascript function; the function itself would be formatted by the servlet,
with the necessary frame content.

AM
Jul 23 '05 #7
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41***********************@newsread4.arcor-online.net...
If you really want to set the frame content with script then it is safer
to have a function write to that frame e.g.
function initFrame () {
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write('html goes here');
frameDoc.document.close();
}

<frameset onload="initFrame();" ...>
<frame src="fallback.html" name="toc">


Martin,

Thank you for the response. I tried your solution, but it does not work.
Here is my Frame.html that should display 2 frames:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Frame 1</title>
<script type="text/javascript">
function initFrame()
{
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write(
"<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
<html>
<head>
<title>Frame 1</title>
</head>
<body>
<H2>Frame 1</H2>
</body>
</html>"
);
frameDoc.document.close();
}
</script>
</head>
<frameset cols="50%,*">
<frame onload=initFrame() src="" name="toc">
<frame src="Frame2.html" name="main">
</frameset>
</html>

The first frame (leftmost) comes out empty. Did I screw up the syntax? Any
ideas?

AM
Jul 23 '05 #8
"Toby Inkster" <us**********@tobyinkster.co.uk> wrote in message
news:pa****************************@tobyinkster.co .uk...
You could use a "data:" URL, but IIRC that's only supported by Gecko and
Presto.


Then it won't work for me as I am targeting IE, NS and possibly Firefox as
the primary browsers.

AM
Jul 23 '05 #9


Alex Molochnikov wrote:
"Martin Honnen" <ma*******@yahoo.de> wrote
If you really want to set the frame content with script then it is safer
to have a function write to that frame e.g.
function initFrame () {
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write('html goes here');
frameDoc.document.close();
}

<frameset onload="initFrame();" ...>
<frame src="fallback.html" name="toc">

I tried your solution, but it does not work.
Looks like you have changed what I posted, see below.
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
If you want to use a DOCTYPE then use the frameset one in this case.
<html>
<head>
<title>Frame 1</title>
<script type="text/javascript">
function initFrame()
{
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write(
"<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
<html>
You need to put a JavaScript string literal on one line, if you want to
have line breaks then use \r\n inside the string literal but what you
have above should simply give a syntax error.

<frameset cols="50%,*">
<frame onload=initFrame() src="" name="toc">


See above where I have put the onload.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #10
----- Original Message -----
From: "Martin Honnen" <ma*******@yahoo.de>
Newsgroups: alt.html,comp.infosystems.www.authoring.html
Sent: Saturday, January 22, 2005 7:00 AM
Subject: Re: Embedded HTML in frameset - is it possible?
Looks like you have changed what I posted, see below.
Yes, I did change it, but only after failing to get the code working in its
original form.
You need to put a JavaScript string literal on one line, if you want to
have line breaks then use \r\n inside the string literal but what you
have above should simply give a syntax error.


And that was it. My Java coding habits got in the way. After removing the
line beaks, the code worked.

Thank you very much.

AM
Jul 23 '05 #11
Alex Molochnikov wrote:
This is an attempt to implement a browser callback to the servlet, mostly
inspired by the Pushlets framework, as described in
http://www.javaworld.com/jw-03-2000/jw-03-pushlet.html. The hidden frame
would contain nothing, it would make a call on the servlet, and receive a
Javascript code from it. The code, in its turn, can make requests on the
servlet.

This whole thing is needed to implement a Web-based frontend for interactive
reports. The clear-view frame would initiate a request on the servlet to
generate a report. Before the request is completed (i.e. before the doPost()
or doGet() method returns), the servlet may have to get some additional info
from the user (such as the customer number for the invoice). This cannot be
done in the same frame without returning from the servlet's doGet/doPost
methods.
Right. You're *supposed* to return from the doGet or dPost method. You
call the method whose purpose is to send the appropriate form to the
user to get request the needed data--and then you return from doGet or
doPost. When the user submits the form, it's submitted to a servlet (it
may be the same servlet as the first one), calling the doPost method
from scratch. It's not a continuation of the previous call. The method
looks up the previous information from the transaction (in either
session variables or session-related tables), incorporates the new data,
and proceeds from there.

What you're doing is an attempt to treat a web application as though it
were a traditional application running on the client machine, consisting
of a single routine that runs from beginning to end, successively
displaying instructions and forms to the user to enter data, and
continuing after the user finishes with each screen. This is an
inefficient, problem-prone way to build web-based applications.
This is where the hidden frame comes in - it will receive the
request from the servlet (a callback) to open another window with the
necessary controls (text fields, buttons etc. depending on the nature of the
additional info).

The page that issues the report request is itself dynamically generated by
the servlet.


Naturally. That's what servlets do: generate pages dynamically. You say
this as though it were a distinctive feature of your application.

Surely you've seen plenty of e-commerce sites. None of them work the way
you're trying to set up your application.

[snip]
Jul 23 '05 #12
"Harlan Messinger" <hm*******************@comcast.net> wrote in message
news:35*************@individual.net...
What you're doing is an attempt to treat a web application as though it
were a traditional application running on the client machine, consisting
of a single routine that runs from beginning to end, successively
displaying instructions and forms to the user to enter data, and
continuing after the user finishes with each screen. This is an
inefficient, problem-prone way to build web-based applications.
This would be so, if the application in question _were_ a Web application.
In reality it is not. This is a report generator that is a traditional
3-tier client-server application that runs as a Swing-based client, and as a
headless server (not servlet) process, and displays the reports in a
Java-generated window (JFrame). And, depending on the design of a particular
report, it _may_ communicate with the user via the server-side callbacks.

Publishing the generated report over the Web is a small appendix to the
entire design, an add-on option. And it must fit into the existing design
structure, which can start the report process in one thread, and then,
before the report finishes, get back to the user in a different thread, get
some additional input, and carry on until the report is done, or until
another callback comes, with more info requests. It is this interactive part
of the functionality that is currently missing from the Web-published
reports, and I am trying to find a way to implement it through a combination
of Javascript, servlet-side callbacks, frames, possibly pop-ups and whatever
else I can think of. The availability of Javascripts, the need to enable
cookies, and any other requirement is not a concern.
Naturally. That's what servlets do: generate pages dynamically. You say
this as though it were a distinctive feature of your application.
The reason I mention it is the need to incorporate the Javascript into that
dynamically generated content, and the difficulties I had (still have)
getting this Javascript code called upon loading the frame, and connecting
back to the servlet.
Surely you've seen plenty of e-commerce sites. None of them work the way
you're trying to set up your application.


They are all based on the complete request-return cycle, with no servlet
callbacks cutting in-between. As explained above, the application in
question does not work this way. In short, it is not a Web application in
the customary sense. I really do not want to come across as trying to turn
this post into a commercial, promoting our product, but if you a curious,
you can have a look at www.reportgenerator.org to see how this thing is
organized.

Regards,

Alex.
Jul 23 '05 #13

"Alex Molochnikov" <NO****@NOSPAM.COM> wrote in message
news:lTaId.136774$6l.113213@pd7tw2no...
Is there any way to embed the HTML code inside FRAMESET? Something like
this:

<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>

I tried using a Javascript function that returns the HTML text, as in the
following code:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head> <title>Frame 1</title>
<script type="text/javascript">
function myFunction()
{
return ("<!doctype html public \"-//w3c//dtd html 4.0
transitional//en\">
<html>
<head>
<title>Frame 1</title>
</head>
<body>
<H2>Frame 1</H2>
</body>
</html>
")
}
</script>
</head>
<frameset cols="50%,*">
<frame src=myFunction() name="toc">

try javascript:myFunction() instead and see what happens.
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>
</html>

but the browser shows the "The page cannot be displayed" for the first
frame.

I am trying to find a way to generate a page from the Java servlet that
would contain a hidden (0-width) frame and a fully visible frame with some
dynamic content.

I will appreciate any clues.

Alex Molochnikov

Feb 4 '06 #14

"Alex Molochnikov" <NO****@NOSPAM.COM> wrote in message
news:lTaId.136774$6l.113213@pd7tw2no...
Is there any way to embed the HTML code inside FRAMESET? Something like
this:

<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>

I tried using a Javascript function that returns the HTML text, as in the
following code:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head> <title>Frame 1</title>
<script type="text/javascript">
function myFunction()
{
return ("<!doctype html public \"-//w3c//dtd html 4.0
transitional//en\">
<html>
<head>
<title>Frame 1</title>
</head>
<body>
<H2>Frame 1</H2>
</body>
</html>
")
}
</script>
</head>
<frameset cols="50%,*">
<frame src=myFunction() name="toc">
<frame src="javascript:'<html></html>'">
is valid (tinker with it).
you can also try
function myFunction() {
window.frames[0].document.write(
"<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
<html>
<head>
<title>Frame 1</title>
</head>
<body>
<H2>Frame 1</H2>
</body>
</html>
");
}
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>
</html>

but the browser shows the "The page cannot be displayed" for the first
frame.

I am trying to find a way to generate a page from the Java servlet that
would contain a hidden (0-width) frame and a fully visible frame with some
dynamic content.

I will appreciate any clues.

Alex Molochnikov

Feb 4 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dan (dj74) | last post by:
Hi All, my application looks like this: (file index.php) application = new MyApplication(); application->run(); //all code of the application is in MyApplication class and other
3
by: Jan Plastenjak | last post by:
This question is about html. I have this: <frameset rows="90%,10%" frameborder="NO" border="0" framespacing="0" cols="1"> <frame name="topFrame" noresize src="c:\bpp.xml"> <frame name="bottom" ...
11
by: Brett | last post by:
In Yahoo mail, I click the Inbox link and see my messages. If I view source, I don't have HTML which contains the URL of each message. The source HTML contains javascripting and framesets. This...
25
by: Steal | last post by:
Hi at all I try to validate this page using the link: http://validator.w3.org/ but it return that this is not a valid HTML 4.01 page please where is it error? Steil <!DOCTYPE HTML PUBLIC...
13
by: Arie Mijnlieff | last post by:
Hi ! I have an html file (http://www.kpc.nl/home.html) which i send to the w3 validator as well as to a an online HTML tidy script. The w3 validator (validator.w3.org) claims the frameset tag...
40
by: VK | last post by:
Hi, After the response on my request from W3C I'm still unclear about Tidy vs. Validator discrepansies. That started with <IFRAME> issue, but there is more as I know. Anyway, this very basic...
3
by: Nish | last post by:
Is HTML frame is an old technology? Will the modern web application are developed using the HTML frames? Does all the browsers support them? Thank you for your suggestion, Nish
6
by: Ashok | last post by:
Hi, I am starting a new project to build a software product using APS.NET 2.0. In past I have used "frameset" and "frame" to build pages. My current requirements I have coded using frameset and...
1
by: Phrogz | last post by:
I have a website with code like the following. I swear it used to work 2 years ago when first written. However, testing in both IE6SP2 and Firefox 1.5 no longer seem to run the script at the top...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.