large amount of hidden iframes??

B

bscofield

What would be the danger in having a lot of hidden iframes? i.e.
potentialy 30-40. I need to store a bunch of data and thought about
using hidden iframes to do it but wasn't sure if this would bog down
my page or not. Opinions? I know this is not an IDEAL way to store
data but I'm at my whitts end and it sounds like a nice workaround
right about now!
 
K

kaeli

What would be the danger in having a lot of hidden iframes? i.e.
potentialy 30-40. I need to store a bunch of data and thought about
using hidden iframes to do it but wasn't sure if this would bog down
my page or not. Opinions? I know this is not an IDEAL way to store
data but I'm at my whitts end and it sounds like a nice workaround
right about now!

It depends, really. If this is a small intranet app used by the 10
people in the office, not much wrong with it other than a possible waste
of your time and energy.

What are you trying to do, and for whom? Is this going to be used by any
Joe Shmoe, who may or may not have JS enabled and might have NN4 still?
Or only people using IE6 with SP3 and JS enabled? etc...

Not all browsers support iframes.

--
 
B

Ben Scofield

Every forum user thinks I'm crazy and ask for code. The problem is that
this is purchased, copyright source code that I'm modifying. Are you
familiar with treeview (from www.treeview.com)? The developer builds a
tree using an array and about 1500 lines of code.
It's a simple "help file" type tree on a page with frames. Check out the
website to see what I mean.

Well he wrote it so that the links that were clicked referenced HTML
pages. I'm generating all this from a database in another language and
don't want the overhead of creating 30-40 different HTML pages. So I've
modified it so that when the item is clicked it sends a variable name as
a text string. The other file load that into an iframe where the
"modify" they're helps and then save it. Well when they save it, I
change the variable to reflect the changes. Problem is that when that
variable is called again, it has it's previous data in it. That is why I
wanted to save the new text to an iframe and just have the variable read
the iframe.
 
K

kaeli

Every forum user thinks I'm crazy and ask for code. The problem is that
this is purchased, copyright source code that I'm modifying. Are you
familiar with treeview (from www.treeview.com)?

That is not a valid site. It brings up some sort of portal page.
Well he wrote it so that the links that were clicked referenced HTML
pages. I'm generating all this from a database in another language and
don't want the overhead of creating 30-40 different HTML pages.

That's reasonable. :)
So I've
modified it so that when the item is clicked it sends a variable name as
a text string. The other file load that into an iframe where the
"modify" they're helps and then save it. Well when they save it, I
change the variable to reflect the changes.

Change the var in the parent window, not the iframe, to keep changes.
The var must be global scoped.
To make this easy, you could have a function in the parent window that
changes the var, much like getters and setters in java.

Example:
test1.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
var globalVar = "cat";
function setIt(val)
{
globalVar = val;
alert("Set var to "+val);
alert("Value of global var is now "+globalVar);
}
function loadPage2()
{
window.document.iframe_1.location = "test2.html";
}
alert("begin: global is "+globalVar);
</script>
</head>
<body>
<p>Click <a href="test2.html" onClick="loadPage2();return false;">this
link</a> to load page 2 in the iframe.</p>
<iframe name="iframe_1" id="iframe_1" src="test3.html"></iframe>
</body>
</html>

test2.html
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>

<body>
<script>
function tellParent(val){
top.setIt(val);
}
</script>

<p>test page to set the parent var</p>
<form name="form1">
Set var to: <input type="text" name="text1"><br>
<input type="button" name="b1" onClick="tellParent(this.form.elements
['text1'].value)">
</form>
</body>
</html>

--
--
~kaeli~
The best part of having kids is giving them back to their
parents.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
B

Brian Genisio

Ben said:
Every forum user thinks I'm crazy and ask for code. The problem is that
this is purchased, copyright source code that I'm modifying. Are you
familiar with treeview (from www.treeview.com)? The developer builds a
tree using an array and about 1500 lines of code.
It's a simple "help file" type tree on a page with frames. Check out the
website to see what I mean.

Well he wrote it so that the links that were clicked referenced HTML
pages. I'm generating all this from a database in another language and
don't want the overhead of creating 30-40 different HTML pages. So I've
modified it so that when the item is clicked it sends a variable name as
a text string. The other file load that into an iframe where the
"modify" they're helps and then save it. Well when they save it, I
change the variable to reflect the changes. Problem is that when that
variable is called again, it has it's previous data in it. That is why I
wanted to save the new text to an iframe and just have the variable read
the iframe.

I would recommend checking to see how much memory your browser is taking
up in a case with no IFRAMES, and one with IFRAMES.

Depending on how a browser is implmented, you will likely have a new DOM
for every page, which _can_ be a huge memory hit. On the other hand, it
might not be any different from having all the content on a single page.

Either way, it seems that 30-40 pages loaded at the same time will be a
memory hog... uless they are all really small. At least see if it is an
issue.

Brian
 
K

kaeli

Change the var in the parent window, not the iframe, to keep changes.
The var must be global scoped.
To make this easy, you could have a function in the parent window that
changes the var, much like getters and setters in java.


Oops - IE/Opera only.
I'm not sure why NN doesn't like window.document.iframe_1.location

Anyone know offhand?
NN says no properties.
IE and Opera are okay, so it must be shortcut syntax.

How should I reference that cross browser, if I can?

--
 

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
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top