473,804 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.htm l" name="main">
</frameset><nofra mes></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.htm l" name="main">
</frameset><nofra mes></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 6541
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.htm l" name="main">
</frameset><nofra mes></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.myFunct ion()" 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.t oc;
frameDoc.docume nt.open();
frameDoc.docume nt.write('html goes here');
frameDoc.docume nt.close();
}

<frameset onload="initFra me();" ...>
<frame src="fallback.h tml" 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.myFunct ion()" 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.t oc;
frameDoc.docume nt.open();
frameDoc.docume nt.write('html goes here');
frameDoc.docume nt.close();
}

<frameset onload="initFra me();" ...>
<frame src="fallback.h tml" 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.htm l" name="main">
</frameset><nofra mes></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******** *****@individua l.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*******@yaho o.de> wrote in message
news:41******** *************** @newsread4.arco r-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.t oc;
frameDoc.docume nt.open();
frameDoc.docume nt.write('html goes here');
frameDoc.docume nt.close();
}

<frameset onload="initFra me();" ...>
<frame src="fallback.h tml" 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.t oc;
frameDoc.docume nt.open();
frameDoc.docume nt.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.docume nt.close();
}
</script>
</head>
<frameset cols="50%,*">
<frame onload=initFram e() src="" name="toc">
<frame src="Frame2.htm l" 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**********@t obyinkster.co.u k> wrote in message
news:pa******** *************** *****@tobyinkst er.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*******@yaho o.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.t oc;
frameDoc.docume nt.open();
frameDoc.docume nt.write('html goes here');
frameDoc.docume nt.close();
}

<frameset onload="initFra me();" ...>
<frame src="fallback.h tml" 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.t oc;
frameDoc.docume nt.open();
frameDoc.docume nt.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=initFram e() src="" name="toc">


See above where I have put the onload.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #10

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

Similar topics

5
2312
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
2118
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" scrolling="NO" noresize src="c:\btn.htm"> </frameset> Is there a way to assign html code to frames "in code", not to have to specify src property? Something like:
11
1983
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 is different from what I am seeing. If I right click on a message link and select "copy shortcut", I can paste this link into my browser. This brings me to my message. If I view source, once again, it is javascript and framesets. How do I...
25
43641
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 "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head>
13
2737
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 doesnt have a border tag whereas the html tidy script (http://infohound.net/tidy/tidy.pl) claims everything is ok.. Who is right ? I am asking this because i would like to write clean
40
5620
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 HTML page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html401/strict.dtd"> <html> <head>
3
2426
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
1659
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 frame like code below. My question is, because this is a new development is it good to use frameset and frame or I can use some thing better. I am looking for expert suggestions on my code below is this a good way to move or I should not use...
1
1711
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 level of the frameet. Is there a way to run JS at the frameset level? (I want to us JS to parse some querystrings passed to the frameset, and use those to pass on to one child frame and change the href of the other child frame.) <!DOCTYPE HTML...
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10073
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.