ForHosting KIT · Web Scraping & Monitoring

Generate a Resource Preload Link Tag for Fonts, CSS, Scripts, and Images

Generate a ready-to-paste resource preload link without memorizing the relationship between a file, its HTML preload destination, and cross-origin behavior.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Supply an absolute or relative resource URL and identify it as a font, style, script, or image. The result uses the matching as attribute, safely escapes the URL for an HTML attribute, and adds anonymous cross-origin loading when the selected resource is a font. Unsupported resource types produce a clear input error instead of plausible but invalid markup.

Choose the resource that deserves an early request

Preload is a focused performance hint, not a general instruction to fetch every asset ahead of time. Use it for a resource that the current page will need soon but that the browser might otherwise discover late, such as a primary web font referenced from a stylesheet, a critical hero image, an important stylesheet, or a script needed during the initial experience. Enter the exact URL the page will request, including its path, query string, or content fingerprint. Absolute URLs, protocol-relative URLs, root-relative paths, and ordinary relative paths are all suitable. The generator preserves that URL while escaping characters that have special meaning inside an HTML attribute. Select the resource type according to how the browser will consume the response, rather than according to a vague filename category. A CSS file is style, JavaScript is script, an image is image, and a web-font file is font. The output is a complete link element ready for the document head.

Understand the as and crossorigin attributes

The as attribute tells the browser what destination the preloaded response will have. That destination affects request priority, security policy, response matching, and whether the later request can reuse the preload. This capability maps each accepted resource type directly to its standardized destination: font becomes as="font", style becomes as="style", script becomes as="script", and image becomes as="image". Fonts receive crossorigin="anonymous" because font fetching uses CORS, including in common cases where the font URL appears to share the page origin. Omitting that attribute can cause the browser to make a second request instead of reusing the preloaded response. The other supported types do not receive a crossorigin attribute automatically because their correct credential mode depends on how the page later requests them. The generator deliberately avoids guessing additional attributes such as type, media, imagesrcset, integrity, or fetchpriority because the two supplied inputs do not contain enough information to set those values reliably.

Place the tag carefully and verify reuse

Put the generated link in the document head early enough to improve discovery, normally before the stylesheet or script that would otherwise reveal the same resource. Keep the href identical to the later request: differences in hostname, path normalization, query parameters, redirects, or CORS mode can prevent reuse. Then inspect the browser developer tools on a fresh page load. The resource should be requested once, should have the intended destination, and should be consumed shortly after loading. Browser warnings about an unused preload are worth investigating; they often mean the hint targets the wrong page, uses a mismatched URL, or preloads something that is not needed during the initial rendering window. Too many preload hints can compete with genuinely critical downloads and make performance worse. Treat each generated tag as a hypothesis to measure, not permanent boilerplate. If an asset is optional, belongs to a later interaction, or is merely likely to be used on another page, a different loading strategy may be more appropriate.

Preload a primary web font

Create a font preload with the anonymous cross-origin attribute needed for the later font request to reuse it.

Prioritize a hero image

Generate an image preload for a stable URL that is critical to the initial viewport.

Prepare deploy-time HTML

Build deterministic preload markup for fingerprinted stylesheets or scripts during a static-site or release pipeline.

Which resource types are supported?

The accepted values are font, style, script, and image. Any other value returns an invalid input error.

Why do font tags include crossorigin?

Font requests use CORS. Matching that request mode lets the browser reuse the preload instead of downloading the font again.

Can the URL be relative?

Yes. Absolute URLs, protocol-relative URLs, root-relative paths, and ordinary relative paths are accepted.

Does the generator check whether the resource exists?

No. It performs no network request. It validates and escapes the supplied text, then generates deterministic markup.

Does preload guarantee faster rendering?

No. It changes resource discovery and priority. Measure the page because unnecessary or mismatched preloads can waste bandwidth and compete with critical work.

What does the API request cost?

The base price is $0.002 per generated item. The browser implementation can run the same deterministic logic locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/web/preload-link-generate

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/web/preload-link-generate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"/assets/site.woff2","type":"font"}'
{
  "url": "/assets/site.woff2",
  "type": "font"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "web.preload_link_generate",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

timeout_sec30
max_crawl_pages25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →