Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6547089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:47:15+00:00 2026-05-25T11:47:15+00:00

I am creating a simple script where a form is submitted, and the result

  • 0

I am creating a simple script where a form is submitted, and the result of form submission is redirected to an iframe.

I want js code to check if the iframe has finished loading the form submission result completely, and only then retrieve the content of that iframe and post it to me in a form post.

I have the code to retrieve the content of iframe, as well as code to send form post, I just need a way to determine if the new page loaded into the iframe, has finished loading or not. I would like to wait for the loading to be complete, and only then retrieve content of that iframe and post it.

Also I would like a simple javascript function to submit all forms in the web page in main window of web browser.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:47:16+00:00Added an answer on May 25, 2026 at 11:47 am

    You can use an event listener for when the document is ready in Chrome and FF, but IE doesn’t support that. Instead, IE has something called readystate that you can handle the change event of. Below are the functions that should handle everything you need to add the event handler. You’ll want to call addLoadHandler, the rest are supporting functions.

    // Adds an onload handler for script and iframe elements (supports IE)
    var _addLoadHandlerCallbackFired = {};
    function addLoadHandler(element, callback) {
        if (typeof callback !== 'function') { return false; }
    
        var callbackID = generateNumericID();   // Generate an ID for the callback
        _addLoadHandlerCallbackFired[callbackID] = false;   // Initialize its state as not fired
        callback = queueCallback(callback, 'addLoadHandler:' + callbackID); // Support multiple callbacks on the same element
        var wrappedCallback = function() {  // Wrap callback to set state to fired when called
                _addLoadHandlerCallbackFired[callbackID] = true;
                return callback.call(element);
        };
    
        // Attach standard load handler
        addEventHandler(element, 'load', wrappedCallback);
    
        /* Hack to replicate element.onload in IE
        Adapted from Nick Spacek's code at https://gist.github.com/461797 */
        addEventHandler(element, 'readystatechange', function() {
                if ((element.readyState === 'loaded' || element.readyState === 'complete') && _addLoadHandlerCallbackFired[callbackID] === false) {
                    return wrappedCallback.call(element);
                }
            });
    
        return true;
    }
    
    // Generates Locally Unique IDs (length parameter is optional)
    function generateNumericID(length) {
        if (typeof length !== 'undefined' && typeof length !== 'number') { return false; }
    
        if (typeof length === 'undefined') {
            length = 20;    // Maximum length before the browser uses scientific notation
        }
        return Math.floor(Math.random() * Math.pow(10, length));
    }
    
    // Queues callback functions to be executed in FIFO order
    var _callbacksQueues = {};
    function queueCallback(callback, id) {
        if (typeof id === 'undefined') { id = callback; }
    
        if (typeof _callbacksQueues[id] === 'undefined') { _callbacksQueues[id] = []; }
        _callbacksQueues[id].push(callback);
    
        return function() {
            while (_callbacksQueues[id].length > 0) {
                _callbacksQueues[id].shift().apply(this, arguments);
            }
        };
    }
    
    // Attaches events with cross-browser support, properly setting the context of this
    function addEventHandler(element, event, handler, capture) {
        if (!isDOMElement(element) || typeof event !== 'string' || typeof handler !== 'function') { return false; }
        if (event.substr(0,2) === 'on') { event = event.substr(2); }    // Strip the 'on' at the beginning of the event if it is present
    
        if (typeof element.addEventListener === 'function') {   // Primary way of adding event listeners
            if (typeof capture === 'undefined') { capture = false; }
            return element.addEventListener(event, handler, capture);
        } else if (typeof element.attachEvent !== 'undefined') {    // Special case for IE (also, strangely typeof element.attachEvent = 'object' in IE)
            return element.attachEvent('on' + event, function(e) { return handler.call(element, e); });
        } else {
            return false;
        }
    }
    
    // Adapted from isPlainObject in jQuery 1.5.2
    function isDOMElement(object) {
        return object && (typeEx(object) === 'object') && (object.nodeType || isWindow(object));
    };
    
    /* Like typeof, but can tell different types of built-in objects apart
    Adapted from jQuery 1.5.2 */
    function typeEx(object) {
        var parameterType = typeof object;
        if (parameterType !== 'object') {
            return parameterType;
        } else {
            if (object instanceof Date) {
                return 'date';
            } else if (object instanceof Array) {
                return 'array';
            } else if (object instanceof RegExp) {
                return 'regexp';
            } else {
                return 'object';
            }
        }
    }
    
    /* A crude way of determining if an object is a window
    Taken from jQuery 1.5.2 */
    function isWindow(object) {
        return object && typeof object === "object" && "setInterval" in object;
    }
    

    As for submitting all forms on the page. You just need to call .submit on each. The below code will do that:

    var forms = document.getElementsByTagName('form');
    for (var formIndex = 0; formIndex < forms.length; formIndex++) {
        forms[formIndex].submit();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a simple form that takes a referal code and email address, stores
When I'm creating a simple Windows form, is it starting in a new thread
I am creating a simple form. I would like to use embedded javascript to
A clueless Python newbie needs help. I muddled through creating a simple script that
i am creating a simple authentication, acl script. i wonder if its ok to
I'd like to create a simple password form or script that redirects the visitor
I am creating a simple script say a.php. I know that drupal 6 creates
I am creating a simple bash script to download and install a python Nagios
I am creating a simple comparison script and I have some questions for the
I was creating a simple web method to access from Java script..But I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.