how can I validate html produced by ajax (asynchronous dynamic html)?

Discussion in 'HTML' started by zzzbla@gmail.com, May 11, 2006.

  1. Guest

    Hi,

    I'm writing an ajax component. The results look different on FireFox
    and on Internet Explorer. I'd like to validate the html I'm producing
    but if I try to save the file and use tidy and/or the firefox
    html-validator extension, I just get the initial html, without the
    stuff added to it by my javascript functions...

    Anyone has a solution?

    Thanks in advance,
    R. Green
     
    , May 11, 2006
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed writing in
    news::

    > Hi,
    >
    > I'm writing an ajax component. The results look different on FireFox
    > and on Internet Explorer. I'd like to validate the html I'm producing
    > but if I try to save the file and use tidy and/or the firefox
    > html-validator extension, I just get the initial html, without the
    > stuff added to it by my javascript functions...
    >
    > Anyone has a solution?
    >
    > Thanks in advance,
    > R. Green
    >
    >


    Sure, Opera and Firefox both have developer toolbars/extensions that will
    allow you to send rendered markup to the validator.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, May 11, 2006
    #2
    1. Advertising

  3. Guest

    Hi Adrienne,

    Thanks for your quick reply.

    Can you name such Firefox extensions? I've been browsing through the
    dev section and couldn't find anything helpful...

    Thanks,
    R. Green
     
    , May 11, 2006
    #3
  4. Gazing into my crystal ball I observed writing in
    news::

    > Hi Adrienne,
    >
    > Thanks for your quick reply.
    >
    > Can you name such Firefox extensions? I've been browsing through the
    > dev section and couldn't find anything helpful...
    >



    <https://addons.mozilla.org/firefox/60/>

    Oh, and that Firefox/IE thingy is pretty good, too.
    <https://addons.mozilla.org/firefox/1419/>

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, May 11, 2006
    #4
  5. Toby Inkster Guest

    zzzbla wrote:

    > I just get the initial html, without the stuff added to it by my
    > javascript functions...


    Aha -- there's the rub. If your document contains:

    <script type="text/javascript">
    document.write('<b><i>Foo<\/b><\/i>');
    </script>

    it will validate because the validator doesn't (and shouldn't) execute
    Javascript. But ensuring that the code spat out by the Javascript is valid
    is still important, because the browsers still have to render it, right?!

    The solution is, once your AJAX has executed, to peek at
    document.body.innerHTML using Javascript and then validate whatever's in
    there.

    Here's a method to do that:

    1. Get Opera 9.0 Beta: http://www.opera.com/
    2. Get the W3-dev Menu 2.91: http://tobyinkster.co.uk/opera
    3. Visit your page and allow the scripts to run.
    4. In Opera go to "W3-dev" > "Generated Source" in the menu.
    5. From the Generated source, copy and paste everything from "<BODY>" to
    "</BODY>" into a text editor.
    6. At the end add "</HTML>" and at the start add a DOCTYPE, followed by
    "<HTML><HEAD><TITLE>Foo</TITLE></HEAD>".
    7. Save the resulting file and upload it to the validator.

    I wonder if that can be made into one step? Hmmm...

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, May 11, 2006
    #5
  6. Guest

    Hi,

    Thanks for all of your replies.

    I finally found a firefox extension that saves the rendered html called
    savegenpage ( https://addons.mozilla.org/firefox/2262/ ) - I just save
    the HTML, reload it and then check it with the html validator extension
    (found at https://addons.mozilla.org/firefox/60/ as Adrienne
    mentioned).


    My code is flawless in regard to the html, and the css is valid as
    well; However - it still shows differently in IE and Firefox!

    I wrote an ajax tree component and I use spans inside spans (with a css
    margin defined for the children) - in Firefox they show exactly as
    you'd think. In IE however, there's an occasional "extra" line break (I
    don't have any line breaks at all) - I couldn't find a pattern when
    they show and when they don't...

    Cheers,
    R. Green
     
    , May 11, 2006
    #6
  7. Hello, you can see generated javascript source with the tracer tool

    http://www.netamo.com/tracer

    It processes the page as the browser does, and traces every function.
    Check it.
    We are developing it and it's still beta, so we appreciate feedback. It
    has some limitations although we are improving it to trace AJAX apps
    correctly. Thanks.



    ha escrito:

    > Hi,
    >
    > Thanks for all of your replies.
    >
    > I finally found a firefox extension that saves the rendered html called
    > savegenpage ( https://addons.mozilla.org/firefox/2262/ ) - I just save
    > the HTML, reload it and then check it with the html validator extension
    > (found at https://addons.mozilla.org/firefox/60/ as Adrienne
    > mentioned).
    >
    >
    > My code is flawless in regard to the html, and the css is valid as
    > well; However - it still shows differently in IE and Firefox!
    >
    > I wrote an ajax tree component and I use spans inside spans (with a css
    > margin defined for the children) - in Firefox they show exactly as
    > you'd think. In IE however, there's an occasional "extra" line break (I
    > don't have any line breaks at all) - I couldn't find a pattern when
    > they show and when they don't...
    >
    > Cheers,
    > R. Green
     
    NETAMO Systems, May 12, 2006
    #7
  8. Guest

    Hi,

    I checked your tracer. It's nice but since it can't async java it's not
    too useful for my purpose. Also, the fact that its a web app and it
    can't access my intranet web renders it unuseful... the firefox
    extensions work like a charm...
     
    , May 13, 2006
    #8
    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. Jason
    Replies:
    0
    Views:
    335
    Jason
    Oct 21, 2006
  2. Guest

    how can I get produced event?

    Guest, Dec 4, 2003, in forum: Javascript
    Replies:
    2
    Views:
    137
    Lasse Reichstein Nielsen
    Dec 4, 2003
  3. Antoon Pardon

    3.2 can't extract tarfile produced by 2.7

    Antoon Pardon, Dec 26, 2012, in forum: Python
    Replies:
    0
    Views:
    162
    Antoon Pardon
    Dec 26, 2012
  4. Steven W. Orr
    Replies:
    0
    Views:
    170
    Steven W. Orr
    Dec 27, 2012
  5. Ian Kelly
    Replies:
    0
    Views:
    150
    Ian Kelly
    Dec 27, 2012
Loading...

Share This Page