Skip to content
This repository was archived by the owner on Aug 5, 2020. It is now read-only.
This repository was archived by the owner on Aug 5, 2020. It is now read-only.

Add support for AJAX content #125

@shogun70

Description

@shogun70

Feature suggestion: Mobify only supports capturing the landing-page. However AJAX and PJAX (pushState + AJAX) loaded content could benefit from the same capability.

My proposed functionality for Mobify has the following:

  1. HTMLParser - this takes the xhr.responseText (or any string) and parses it to create a HTMLDocument
  2. DOMProcessor - applies processing rules to a document
  3. Glue - make the parser and processor work for the captured landing page, etc.

HTMLParser

Looking forward, the HTMLParser will be part of the browsers XMLHttpRequest. In IE8 and below it would be nice to enable html5 elements. Also, in IE9 and below the mere creation of <img src> downloads the resource, so it would be necessary to escape @src before parsing.

DOMProcessor

I suppose this contains a bunch of optional convenience rules, and the capability for externally provided processing.

Glue

  • I feel that using document.write is a mistake. Mobify generates a DOM - just insert that into the window document. Scripts will need special handling, but that is potentially a win because it allows you to schedule their loading / execution. At least allow this to be controlled externally.
  • A responsive work-around to prevent pre-loading of images is to use something like <a href class="image">. People who use this approach might still prefer mobify if it could do in-place DOM-processing (instead of capture-to-external-document-then-rewrite-page).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions