bolt
Advanced Features
Deep linking, orientation, and more
Deep Linking
Open specific pages from external links
Deep links allow external apps to open specific pages in your app. Configure your deep link scheme in the dashboard.
// Deep link format: yourscheme://path
// Example: shift2appjs://products/123
// Handle deep links in your website
document.addEventListener("DOMContentLoaded", () => {
const params = new URLSearchParams(window.location.search);
const deepLink = params.get("deeplink");
if (deepLink) {
handleDeepLink(deepLink);
}
});
function handleDeepLink(path) {
if (path.startsWith("products/")) {
const productId = path.split("/")[1];
window.location.href = "/product/" + productId;
} else if (path === "cart") {
window.location.href = "/cart";
}
}
Orientation
Control screen orientation
shift2appjs.setOrientation(orientation)
Locks the screen to a specific orientation.
Parameters
orientation
String - "portrait", "landscape", or "auto"
Returns
void
// Lock to portrait
shift2appjs.setOrientation("portrait");
// Lock to landscape for video
function enterFullscreenVideo() {
shift2appjs.setOrientation("landscape");
}
function exitFullscreenVideo() {
shift2appjs.setOrientation("portrait");
}
// Allow rotation
shift2appjs.setOrientation("auto");
Screenshot Prevention
Block screenshots for security
shift2appjs.setScreenshotEnabled(enabled)
Enables or disables screenshot capability.
Parameters
enabled
Boolean - true to allow, false to block
Returns
void
// Disable screenshots on sensitive pages
if (location.pathname.includes("/payment")) {
shift2appjs.setScreenshotEnabled(false);
}
// Re-enable when leaving
window.addEventListener("beforeunload", () => {
shift2appjs.setScreenshotEnabled(true);
});
Pull to Refresh
Enable/disable pull-to-refresh
shift2appjs.setPullToRefresh(enabled)
Enables or disables pull-to-refresh gesture.
Parameters
enabled
Boolean - true to enable
Returns
void
// Disable on pages with vertical scrolling content
if (document.querySelector(".scrollable-list")) {
shift2appjs.setPullToRefresh(false);
}
// Enable on main page
shift2appjs.setPullToRefresh(true);
More Functions
shift2appjs.setKeepScreenOn(enabled)
Prevents screen from turning off.
Parameters
enabled
Boolean - true to keep screen on
Returns
void
// Keep screen on during video playback
function playVideo() {
shift2appjs.setKeepScreenOn(true);
// ... play video
}
function stopVideo() {
shift2appjs.setKeepScreenOn(false);
}
shift2appjs.getAppVersion()
Returns the app version string.
Returns
String - Version like "1.2.3"
const version = shift2appjs.getAppVersion();
console.log("App version:", version);