Capturing the content/state of the HTML Page along with the changes

Discussion in 'Javascript' started by praveenmmohanan@gmail.com, Jan 10, 2007.

  1. Guest

    Hi...,

    We have a pretty huge form where the user/support spends more than
    6 minutes. Now, behind the scenes, I wanted to capture the outerHTML
    data & send it to a different URL to save it in draft.

    Now there is no outerHTML in Firefox. secondly even innerHTML is
    different for IE & Firefox as in IE the updates I do to the text field
    are now visible in the innerHTML text but the changes are not visible
    when I run the javascript in Firefox.

    For eg. if there is a Text Box which alreay has value "100" & I change
    it to "1000". The innerHTML o/p in IE shows the value "1000" correctly
    where as in Firefox it shows "100".

    My main intention is to capture the current HTML state (along with the
    changes) and post it to a different URL while the user is filling the
    current form.

    How do I achieve it,?

    Regards,

    Praveen
    , Jan 10, 2007
    #1
    1. Advertising

  2. Evertjan. Guest

    wrote on 10 jan 2007 in comp.lang.javascript:

    > Hi...,
    >
    > We have a pretty huge form where the user/support spends more than
    > 6 minutes. Now, behind the scenes, I wanted to capture the outerHTML
    > data & send it to a different URL to save it in draft.
    >
    > Now there is no outerHTML in Firefox.


    The outer element's innerHTML can be the inner's the outer one, methinks.

    > secondly even innerHTML is
    > different for IE & Firefox as in IE the updates I do to the text field
    > are now visible in the innerHTML text but the changes are not visible
    > when I run the javascript in Firefox.
    >
    > For eg. if there is a Text Box which alreay has value "100" & I change
    > it to "1000". The innerHTML o/p in IE shows the value "1000" correctly
    > where as in Firefox it shows "100".
    >
    > My main intention is to capture the current HTML state (along with the
    > changes) and post it to a different URL while the user is filling the
    > current form.


    That seeme a bad idea, Praveen.

    Do not expect different browsers to act the same while building the DOM
    tree from the same html source.

    All you need is the form's input content,
    because the html is already known to you.

    So why not use the DOM to collect that content and send it to the other
    server using XMLHTTP.

    You could do that, say, every 10 seconds or so.

    =====================================

    Something like [not tested, just an idea, read as pseudocode]:

    var z = '';
    var coll = document.forms[0].getElementsBytagName('input');
    for (i in coll)
    z += coll.name + ':' + coll.value.replace(/[:;]/g,'?') + ';'

    var http = new ActiveXObject("Microsoft.XMLHTTP");
    // do the good thing for FF too here [like new XMLHttpRequest();]
    http.open("POST", "http://....", true[?]);
    http.setRequestHeader("Content-Type", ....... );
    http.send(z);


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jan 11, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WJ
    Replies:
    12
    Views:
    791
  2. Joergen Bech
    Replies:
    0
    Views:
    535
    Joergen Bech
    Jul 27, 2005
  3. hazz
    Replies:
    6
    Views:
    49,531
    SkyUCHC
    Jun 9, 2010
  4. Rey
    Replies:
    0
    Views:
    566
  5. sasuke
    Replies:
    2
    Views:
    371
    sasuke
    Mar 22, 2008
Loading...

Share This Page