{"id":21310952,"url":"https://github.com/webqit/oohtml-ssr","last_synced_at":"2026-03-03T18:32:23.422Z","repository":{"id":41420478,"uuid":"319670165","full_name":"webqit/oohtml-ssr","owner":"webqit","description":"A server-side DOM implementation with native support for OOHTML - based on jsdom.","archived":false,"fork":false,"pushed_at":"2026-01-31T12:22:31.000Z","size":547,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-01T00:13:37.220Z","etag":null,"topics":["jsdom","oohtml","server-side-rendering"],"latest_commit_sha":null,"homepage":"https://webqit.io/tooling/pseudo-browser","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webqit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ox-harris","patreon":null,"open_collective":"webqit","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-12-08T14:52:37.000Z","updated_at":"2026-01-31T12:22:31.000Z","dependencies_parsed_at":"2022-09-26T17:00:58.925Z","dependency_job_id":"f5876911-a660-490d-b83f-eff1fef4a654","html_url":"https://github.com/webqit/oohtml-ssr","commit_stats":{"total_commits":182,"total_committers":3,"mean_commits":"60.666666666666664","dds":0.6098901098901099,"last_synced_commit":"228116492ab707ede43dd0352fa51acf3aff2f66"},"previous_names":["webqit/pseudo-browser"],"tags_count":80,"template":false,"template_full_name":null,"purl":"pkg:github/webqit/oohtml-ssr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webqit%2Foohtml-ssr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webqit%2Foohtml-ssr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webqit%2Foohtml-ssr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webqit%2Foohtml-ssr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webqit","download_url":"https://codeload.github.com/webqit/oohtml-ssr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webqit%2Foohtml-ssr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30054601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jsdom","oohtml","server-side-rendering"],"created_at":"2024-11-21T17:15:18.763Z","updated_at":"2026-03-03T18:32:23.387Z","avatar_url":"https://github.com/webqit.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ox-harris","https://opencollective.com/webqit"],"categories":[],"sub_categories":[],"readme":"# OOHTML Server-Side Rendering\n\n\u003c!-- BADGES/ --\u003e\n\n\u003cspan class=\"badge-npmversion\"\u003e\u003ca href=\"https://npmjs.org/package/@webqit/oohtml-ssr\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@webqit/oohtml-ssr.svg\" alt=\"NPM version\" /\u003e\u003c/a\u003e\u003c/span\u003e\u003cspan class=\"badge-npmdownloads\"\u003e\u003ca href=\"https://npmjs.org/package/@webqit/oohtml-ssr\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/@webqit/oohtml-ssr.svg\" alt=\"NPM downloads\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003c!-- /BADGES --\u003e\n\nOOHTML SSR is a server-side DOM implementation with native support for [OOHTML](https://github.com/webqit/oohtml). It makes it straight-forward to render OOHTML-based documents right on the server. This library is based on [jsdom](https://github.com/jsdom/jsdom)!\n\n\u003e **Note**\n\u003e \u003cbr\u003eThis is documentation for `OOHTML-SSR@1.2.x` - for working with [`OOHTML@2.x`](https://github.com/webqit/oohtml/tree/next). (Looking for [`OOHTML-SSR@1.1.x`](https://github.com/webqit/oohtml-ssr/tree/v1.1.5)?)\n\n## Installation\n\nWith [npm available on your terminal](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), run the following command to install OOHTML SSR.\n\n\u003e System Requirements: Node.js 14.0 or later.\n\n```js\nnpm i @webqit/oohtml-ssr\n```\n\n## Usage\n\nImport and call the `createWindow` function with an HTML *document* and a `params` object. *Document* can be either an HTML markup string or file name.\n\n```js\nimport ( createWindow ) from `@webqit/oohtml-ssr`;\n\n// The params.url is required\nconst params = { url: 'http://localhost' };\nconst window = createWindow( `./index.html`, params );\n\n// Get serialized document\nconst html = window.toString(); // Alternatively: '\u003c!DOCTYPE html\u003e' + window.document.documentElement.outerHTML\n```\n\n\u003e File name is relative to the Current Working Directory but can be an absolute url.\n\nThe OOHTML polyfill is loaded at the document level:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cscript ssr src=\"https://unpkg.com/@webqit/oohtml@latest/dist/main.js\"\u003e\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n    \u003c/body\u003e\n\u003chtml\u003e\n```\n\n### Options\n\n+ **`url`: `String`** - (Required) The URL that translates to `widnow.location`.\n+ **`userAgent`: `String`** - The User Agent string used to fetch sub resources. (Defaults to: `@webqit/oohtml-ssr`.)\n+ **`beforeParse`: `Function`** - An optional function to call before page parsing begins. This function receives the created `window` object.\n\n### Import-Based Instantiation\n\nIt is possible to directly obtain a DOM instance with an `import` expression. Simply import from the `@webqit/oohtml-ssr/instance.js` module with your HTML file name, and other relevant instance parameters, serialized in the import URL.\n\n```js\nimport { window, document } from '@webqit/oohtml-ssr/instance.js?file=index.html\u0026url=http://localhost';\n```\n\n```js\nconst { window, document } = await import( '@webqit/oohtml-ssr/instance.js?file=index.html\u0026url=http://localhost' );\n```\n\n\u003e Import-based instantiation may be useful when you want to take advantage of the import cache to keep instances cached per URL.\n\n### DOM Readiness\n\nIt is often necessary to know at what point the document has been fully loaded and ready to be traversed. You'd normally want to listen for the [`window.onload`](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event.\n\n```js\nawait new Promise( res =\u003e window.addEventListener( 'load', res ) );\n// console.log( 'DOM is ready!' );\nconst html = window.toString();\n```\n\nAlso, in some cases, certain *async* operations within scripts in the loaded document may need to be awaited before serializing the document. But you should test with your usecase to know if this is necessary.\n\n```js\nawait new Promise( res =\u003e setTimeout( res, 10 ) );\nconst html = window.toString();\n```\n\n### Subresource Loading\n\nBy default, subresources (`\u003cscript src\u003e`, etc) embedded on the HTML document are not fetched! But the Boolean attribute `ssr` can be added to a resource to get it fetched.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cscript ssr src=\"/script.js\"\u003e\u003c/script\u003e\n        \u003ctemplate ssr src=\"/bundle.html\"\u003e\u003c/template\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n    \u003c/body\u003e\n\u003chtml\u003e\n```\n\nNote that relative URLs are resolved against the value of `window.location`/`document.URL` which is controlled by the [`options.url`](#options) parameter. For example, given `options.url = \"hhtp://localhost/path\"`, the relative URL `/script.js` will evaluate to `hhtp://localhost/script.js`. But this goes a bit differently when `window.location` is a `file:` URL; relative URLs are resolved against the full *path*, not the *origin*. So, given `options.url = \"file:///C:base/path\"`, the relative URL `/script.js` will resolve to `file:///C:base/path/script.js`. (And it's successfully loaded from the filesystem where exists.)\n\n## Getting Involved\n\nAll forms of contributions and PR are welcome! To report bugs or request features, please submit an [issue](https://github.com/webqit/oohtml-ssr/issues). For general discussions, ideation or community help, please join our github [Discussions](https://github.com/webqit/oohtml-ssr/discussions).\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebqit%2Foohtml-ssr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebqit%2Foohtml-ssr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebqit%2Foohtml-ssr/lists"}