473,287 Members | 1,447 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,287 software developers and data experts.

iFrame onLoad Problem

Hi,

I'm fairly new to javascript and was hoping i could have a little help...

I have a page containing a form and an iframe. The iframe is initially empty (src="about:blank"). The target of the form is the iframe, so when the form is submitted the iframe loads a page (which is remote and I cannot edit). What i would like to happen is that when the contents of the iframe has finished loading, the page (as in: the entire page) then redirects to another page.

Below is a simplified example of the kind of thing i've been trying, but not been able to make work:


Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <script language="Javascript">
  5.  
  6. function func() {
  7.     document.getElementById("ifrm").onload = re();
  8. }
  9. function re() {
  10.     document.location.href = "nextpage.php";
  11. }
  12.  
  13. </script>
  14. </head>
  15.  
  16. <body>
  17.  
  18. <form action="somepage.php" target="ifrm">
  19.     etc etc
  20. <input type="submit" onClick="func();">
  21. </form>
  22.  
  23. <iframe id="ifrm" name="ifrm" src="about:blank"></iframe>
  24.  
  25. </body>
  26. </html>

It is very important that the solution is cross-browser compatible and i believe (although i may be wrong) that Safari does not support 'onload' events for iframes. If so, is there a work-around?

Thanks for your time,

Chris
Sep 13 '07 #1
3 2937
Still really struggling with this, even the smallest amount of help would be much appreciated!

There must be a genius here who can give me some help!
Sep 13 '07 #2
epots9
1,351 Expert 1GB
iframes do not have an onload event, they use the onload of page its loading.
Sep 13 '07 #3
So is what i am doing not possible given that the iframe page is remote and i am not able to edit it?
Sep 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rich | last post by:
Is there any way I can check to see if a document is loaded into the iframe before I call onLoad (sort of an afterLoad). I'm loading up a page into an iframe. But because we use four servers...
4
by: Mark | last post by:
I am loading source files into several iframes, with each load happening after some user-generated event (like clicking a button). The loading works but I need to determine when the source file is...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
1
by: khothikhe | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari...
16
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe");...
8
by: niebo077 | last post by:
Look at the following code: <html> <head> </head> <body> <iframe id="olaf" name="olaf" onload="alert('no');"></iframe><br> <input type="submit"...
0
by: dimepiece18 | last post by:
On our Intranet homepage, I have a layer with an iframe contained in it. The iframe is linked to an html document that is stored in our Content Library system. You have to be authorized to view the...
7
by: Tom Cole | last post by:
IFrames have been used by years for people to accomplish many of the tasks the XMLHttpRequest does for them now...I unfortunately am late in the game and XMLHttpRequest was already out there by the...
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.