community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Tip – Access the Clipboard with Business Central

This post explains how to use the WebPageViewer control add-in to implement a copy-to-clipboard feature for URLs and text in Business Central pages, including handling browser security restrictions on HTTP connections.

post James Pearson

James Pearson · 2025-04-24 · 489 words · about 2 min

"That is because by default the clipboard is not available to sites which are served over http."

Key points

  • WebPageViewer control add-in can display HTML and JavaScript for lightweight UI enhancements without building custom add-ins
  • Use JavaScript’s navigator.clipboard.writeText() to copy text to clipboard and add event listeners for user feedback
  • HTTP connections block clipboard access by default; enable ‘Insecure origins treated as secure’ browser flag for local testing
  • HTTPS connections work without additional configuration for clipboard operations

Quotes

  • “That is because by default the clipboard is not available to sites which are served over http.” (Explains the root cause of clipboard failures in local testing environments and why configuration is needed)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

  • other “WebPageViewer”

Context

  • Features: WebPageViewer control add-in, Clipboard access, JavaScript integration, HTML rendering, Copy to clipboard button

Source: James Pearson, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.