What changes for you#
- Upgrade to
@salopha/mini-app-sdk1.3 (the hosted UMD bundle is already 1.3). - Add
webanddesktopto your manifest'splatforms. - Allow SALOPHA Web to frame your page (below).
initialize(), the sign-in code and every bridge method behave the same. getContext().platform (and getAppInfo().platform) tells you web or desktop when a layout needs to know.
How it works#
| Where | How your page runs | Transport |
|---|---|---|
SALOPHA Web (web.salopha.com) | In a sandboxed frame. SALOPHA checks the frame's origin against your manifest and gives it no access to its own page. | postMessage between your page and SALOPHA Web, checked by origin and source both ways |
| macOS, Windows | In a web view inside the desktop app | The same native channel as on phones |
| Linux | In the system browser (no web view there) | Standalone: sign-in only |
| A window of its own (web and desktop), when the user picks «Open in a separate window» or opens a desktop shortcut | A browser popup on the web, a native window on macOS, a browser app window on Windows and Linux | Standalone: sign-in only |
The SDK chooses the transport by itself. For the frame, SALOPHA adds salopha_transport=postmessage and salopha_host_origin to your launch URL, and the SDK accepts only known web clients (WEB_HOST_ORIGINS, today https://web.salopha.com) and only when the page really is framed. Anything else could feed your page a sign-in code of its own choosing.
Allow the frame#
Send this header from your pages (keep your own origin and any others you need):
Content-Security-Policy: frame-ancestors 'self' https://web.salopha.com
Without it, browsers may refuse to show your page inside SALOPHA Web.
Layout#
- Every width. The same page is shown at phone width, in the detail column of SALOPHA Web and the desktop apps (about 700 to 1100 pixels), and in a window of its own that opens at 1200 × 820 and can be resized. Lay it out by width with breakpoints, not by device.
- Navigation. A bottom tab bar belongs on phones only. From about 768 pixels, move the same destinations to a top bar or a side menu, and drop the space reserved for the tab bar.
- Wide screens. Keep content in a centred column of about 1200 pixels at most, show lists as grids of two to four columns, put detail pages in two columns (content, plus a sticky panel with the price and the main action), and show bottom sheets as centred dialogs.
- Pointer and keyboard. Hover states and focus outlines matter on a computer.
- Language and theme. As on phones, follow
ctx.localeandctx.theme, not the browser's own settings.
Device features#
The frame has no camera, microphone or location permission of its own: navigator.mediaDevices and navigator.geolocation fail by design. Use the bridge (pickImage, getLocation, scanQr and friends); SALOPHA asks for the same consent as on a phone. Some features have no meaning on a computer (home-screen shortcuts, for example) and answer accordingly; check canCreateShortcut() and handle unavailable.
Separate windows and desktop shortcuts#
On a computer, users can open your app in a window of its own, beside SALOPHA (from its menu, its details page, or a double click on it in the Services tab), and the desktop apps can put a shortcut to it on the desktop that opens it straight in that window. The window opens at computer size, 1200 × 820, so it needs the wide layout above. SALOPHA still runs the whole launch flow first (sign-in, consent, availability), then opens your launch URL in standalone mode, exactly as on Linux below. Make sure your app is usable there: sign-in, browsing and anything your own server handles. When the user needs something from SALOPHA (sending to a chat, a payment, a picker), say so and let them open the app inside SALOPHA. A desktop shortcut needs runtime.allowShortcut, like a phone home-screen shortcut.
Linux opens the system browser#
There is no web view on Linux, so the desktop app opens your launch URL in the system browser with salopha_transport=standalone and a one-time sign-in code in the URL fragment (fragments never reach a server). The SDK takes the code, wipes it from the address bar and returns it from the first requestAuthCode(), so sign-in works. Later requestAuthCode() calls (silent renewal) and every other bridge method answer not_in_host: hide those actions, and when your session expires ask the user to open the app again from SALOPHA.
try {
await app.pickImage({ source: "camera" });
} catch (e) {
if (e instanceof SalophaBridgeError && e.code === "not_in_host") hideCameraButton();
}
Checklist#
- SDK 1.3 on every page that SALOPHA opens.
platformsincludeswebanddesktop.frame-ancestorsallowshttps://web.salopha.com.- The page looks right at phone width, at 820, 1280 and 1440 pixels wide, with no horizontal scrolling, and the bottom tab bar shows on phones only.
- Actions that need the bridge degrade gracefully on
not_in_host. - The app works in a window of its own (standalone): sign-in, browsing, and a clear way back into SALOPHA for the rest.