I don't think that an iframe is a popup

W

webEater

Hi

I have a problem with a piece of javascript. i am working on a
workaround for non ajax compatible browser like ie 5/6 without activeX
and opera8-

I use dynamically created iframes and forms to make a request, a simple
version for you to understand:

Code:
....
<body onclick="request()">

<!--<iframe src="" id="Iframe" name="Iframe"></iframe>--> <-- remove
the comments and it works -->

<script type="text/javascript">
onload = function() {
s = document.createElement('iframe');
s.src = '';
s.id = s.name = 'Iframe';
document.body.appendChild(s);

f = document.createElement('form');
f.id = f.name = 'Form';
f.action = '';
f.method = 'post';
f.target = 'Iframe';
f.style.display = 'none';
document.body.appendChild(f);
}

request = function() {
f.action='...';
f.submit();
}
</script>
....

How you see a form and iframe are created on load, then the function
"request" is started when you click somewhere in the body.
- If the iframe is dynamically created - this case - ie 5 opens a popup
with the content of the iframe and ie 6 shows an error. All the other
browsers behave normally.
- If I don't create it by function but simply include it in source
code, it works in ie too

I don't understand it but it's a bug, the only work to workaround this
is to use GET as request method.

Does somebody know this problem?

Thanks,

Andi
 
R

Randy Webb

webEater said the following on 9/14/2006 6:33 PM:
Hi

I have a problem with a piece of javascript. i am working on a
workaround for non ajax compatible browser like ie 5/6 without activeX
and opera8-

There is a better work around if you control the data you are getting
from the server. Simply dynamically load .js files and format your data
for processing on the client. It can all be done without ajax at all.

request = function() {
f.action='...';
f.submit();

f refers to *nothing*. Try using document.forms['Form'].action and
submit() and at least then it works in Mozilla/Firefox. It does what you
want in IE7 but I don't have IE6 so I can't test it there right now.
 
W

webEater

There is a better work around if you control the data you are getting
from the server. Simply dynamically load .js files and format your data
for processing on the client. It can all be done without ajax at all.

I tried this out (for make cross domain requests) but I wasn't able to
read the innerHTML of a script tag (in the case a file is included by
src="...").
f refers to *nothing*. Try using document.forms['Form'].action and
submit() and at least then it works in Mozilla/Firefox. It does what you
want in IE7 but I don't have IE6 so I can't test it there right now.

I think that f holds the form element I created. But I will try your
advice,

thank you

Andi
 
R

Randy Webb

webEater said the following on 9/15/2006 5:44 AM:
I tried this out (for make cross domain requests) but I wasn't able to
read the innerHTML of a script tag (in the case a file is included by
src="...").

That's not how you dynamically load a .js file though.
f refers to *nothing*. Try using document.forms['Form'].action and
submit() and at least then it works in Mozilla/Firefox. It does what you
want in IE7 but I don't have IE6 so I can't test it there right now.

I think that f holds the form element I created.

When you get to the request function, it doesn't.
 

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,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top