fullScrollJs constant

String const fullScrollJs

JavaScript code to determine the maximum potential width and height of the HTML document by taking the largest values from scrollWidth, offsetWidth, and clientWidth properties of both document.body and document.documentElement. This is useful for capturing the full scrollable content size.

Returns a JavaScript array: [totalWidth, totalHeight]

Implementation

static const fullScrollJs = """
(function() {
    var body = document.body;
    var html = document.documentElement;

    // Get the total width including any overflow
    var totalWidth = Math.max(
        body.scrollWidth, html.scrollWidth,
        body.offsetWidth, html.offsetWidth,
        body.clientWidth, html.clientWidth
    );

    // Get the total height
    var totalHeight = Math.max(
        body.scrollHeight, html.scrollHeight,
        body.offsetHeight, html.offsetHeight,
        body.clientHeight, html.clientHeight
    );

    return [totalWidth, totalHeight];
})();
""";