{"id":15451264,"url":"https://github.com/digitalkaoz/preload-polyfill","last_synced_at":"2025-07-25T22:31:05.783Z","repository":{"id":75171601,"uuid":"110044163","full_name":"digitalkaoz/preload-polyfill","owner":"digitalkaoz","description":"polyfills link[rel=\"preload\"] for legacy browsers","archived":false,"fork":false,"pushed_at":"2018-06-27T07:39:09.000Z","size":145,"stargazers_count":21,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-20T00:48:03.563Z","etag":null,"topics":["javascript","performance","polyfill","preload"],"latest_commit_sha":null,"homepage":null,"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/digitalkaoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-11-08T23:53:53.000Z","updated_at":"2024-04-15T03:09:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"97918064-79db-4da6-b875-85fde4dff0cd","html_url":"https://github.com/digitalkaoz/preload-polyfill","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/digitalkaoz/preload-polyfill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fpreload-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fpreload-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fpreload-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fpreload-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalkaoz","download_url":"https://codeload.github.com/digitalkaoz/preload-polyfill/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalkaoz%2Fpreload-polyfill/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267072681,"owners_count":24031430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["javascript","performance","polyfill","preload"],"created_at":"2024-10-01T21:22:09.861Z","updated_at":"2025-07-25T22:31:05.727Z","avatar_url":"https://github.com/digitalkaoz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Preload Polyfill\n\n\u003e it just works...\n\n## What \u0026 Why\n\n`preload` seems the best async loading mechanism today...\n\nhttps://caniuse.com/#search=preload\n\nsome good reads:\n\n* https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf\n* https://hacks.mozilla.org/2017/09/building-the-dom-faster-speculative-parsing-async-defer-and-preload/\n* https://www.smashingmagazine.com/2016/02/preload-what-is-it-good-for/\n* https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n\n## Install with npm\n\n```\nnpm install @digitalkaoz/preload-polyfill\n```\n\n## Usage\n\nThis Polyfill supports the following types:\n\n- [x] js\n- [x] css\n- [x] font\n- [x] image\n- [ ] audio (not well tested)\n- [ ] document (not well tested)\n- [ ] embed (not well tested)\n- [ ] fetch (not well tested)\n- [ ] object (not well tested)\n- [ ] track (not well tested)\n- [ ] worker (not well tested)\n- [ ] video (not well tested)\n\nhttps://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n\n**Integration in your Page**\n\n\u003e the `polyfill` and the `invoke` script are seperated\n\n```html\n    \u003cscript src=\"/dist/preload-polyfill.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"/dist/preload-polyfill-invoke.min.js\"\u003e\u003c/script\u003e\n```\n\nadditionally you need an inline script (for browsers that are preload capable, preloading stuff could be faster than loading an external sync script, and you would miss the `load` event)\n\n```html\n    \u003cscript\u003e/dist/preload-polyfill-inline.min.js\u003c/script\u003e\n```\n\n**Preloading Stuff**\n\nsimply use it as follows:\n\n```html\n\u003clink rel=\"preload\" as=\"script\" href=\"jquery.js\" /\u003e\n```\n\n\n### Additional Features\n\n\u003e beware those are not spec compliant features\n\n**critical**\n\nthose resources will be fetched non blocking, but executed first in order they appear\n\n```html\n\u003clink rel=\"preload\" critical as=\"script\" href=\"jquery.js\" /\u003e\n```\n\n**fonts**\n\nto preload fonts correctly you have to set a name property on the links\n\n```html\n\u003clink rel=\"preload\" name=\"FontName\" weight=\"bold\" as=\"font\" crossorigin type=\"font/woff2\" href=\"font.woff2\" /\u003e\n```\n\n**module**\n\nthose resources will only be fetched if browser understands es6\n\n```html\n\u003clink rel=\"preload\" module as=\"script\" href=\"app.es6.js\" /\u003e\n```\n\n**nomodule**\n\nthose resources will only be fetched if browser cant understand es6\n\n```html\n\u003clink rel=\"nomodule\" as=\"script\" href=\"app.legacy.js\" /\u003e\n```\n\n**AllScriptsExecuted Event**\n\n`window.onload` can be fired even if not all preloaded scripts are executed, therefore we dispatch an event `AllScriptsExecuted` which indicates all preloaded stuff is executed too.\n\n## Development\n\n```\n$ npm start\n```\n\nnow visit https://localhost:5000\n\n## TODOS\n\n- [ ] With \"disable-cache\" the requests will be made twice\n- [ ] tests\n- [ ] make the execution of the preloaded scripts delay `window.onload` so we can get rid of the custom Event (already works in Chrome)\n- [ ] media support (https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content#Including_media)\n\n## Thanks\n\n* https://github.com/jonathantneal/preloadfill\n* https://github.com/aFarkas/link-preload\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalkaoz%2Fpreload-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalkaoz%2Fpreload-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalkaoz%2Fpreload-polyfill/lists"}