Embed NXT Content into your App

The best way to show NXT content in a mobile app is a WebView. You can use the same embed code as on your website, or load a URL that already embeds the content.

App/WebView origin check (must-read for app integrations)

The embed only shows content if the request origin matches your allowed embed domains (in NXT: Settings → General → Allowed embed domains).

  • What we check: the request origin (the WebView’s window.location.origin: scheme + host [+ port]). For https:// pages we compare its domain, for any other scheme the scheme itself.
  • Typical app cases: 1) Load a normal https:// URL in a WebView 2) Load local HTML inside the WebView

Android specifics

  • Hosted page: use webView.loadUrl("https://your-domain/..."). Make sure that domain is in the allowed embed domains.
  • Local HTML:
    • loadDataWithBaseURL(baseUrl, html, ...) with baseUrl set to an https:// address on an allowed domain; requests use that origin.
    • Or use WebViewAssetLoader with setDomain to serve local assets under an https:// host. Add that host’s domain to the allowed embed domains.
  • If your local pages run under a custom scheme (for example myapp://), list the scheme as myapp:.

iOS specifics

  • Hosted page: use WKWebView and load an https:// URL; add that domain to the allowed embed domains.
  • Local HTML: loadHTMLString(embedHtml, baseURL: httpsBaseUrl) works if httpsBaseUrl points to an allowed domain. The WebView uses the baseURL origin for requests.
  • With a custom URL scheme handler (for example myapp://), list the scheme as myapp:.

Don’t load the embed from file://: depending on the WebView, such pages have a null origin, which is always blocked, or a file: origin.

Quick troubleshooting

  • In the WebView dev tools, run window.location.origin and compare it to your allowed embed domains.
  • Ensure you are loading over https:// or your listed app scheme (not file://).
  • Check redirects: did the page land on a different host than expected?
  • If the element shows “This content is not enabled for this website”, the origin is not allowed yet.

Storage in WebViews

The embed works without browser storage. If the WebView keeps no storage, it can’t remember a reader across app starts: for example, a poll the reader answered shows as unanswered again. What the embed stores, and when, is described in Data Protection.