By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,384 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,384 IT Pros & Developers. It's quick & easy.

I don't think that an iframe is a popup

P: n/a
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:

Expand|Select|Wrap|Line Numbers
  1. ....
  2. <body onclick="request()">
  3.  
  4. <!--<iframe src="" id="Iframe" name="Iframe"></iframe>--<-- remove
  5. the comments and it works -->
  6.  
  7. <script type="text/javascript">
  8. onload = function() {
  9. s = document.createElement('iframe');
  10. s.src = '';
  11. s.id = s.name = 'Iframe';
  12. document.body.appendChild(s);
  13.  
  14. f = document.createElement('form');
  15. f.id = f.name = 'Form';
  16. f.action = '';
  17. f.method = 'post';
  18. f.target = 'Iframe';
  19. f.style.display = 'none';
  20. document.body.appendChild(f);
  21. }
  22.  
  23. request = function() {
  24. f.action='...';
  25. f.submit();
  26. }
  27. </script>
  28. ....
  29.  
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

Sep 14 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

<snip>
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.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 15 '06 #2

P: n/a
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

Sep 15 '06 #3

P: n/a
webEater said the following on 9/15/2006 5:44 AM:
>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="...").
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.