Open Url
Opens URL in the app
Description
The openURL action opens any external or internal web URL within the Superfans app.
It’s ideal for linking to blog posts, policy pages, promotions, or any content hosted outside your app while keeping users inside your app experience.
Function Signature
VajroSDK.actions.openUrl({
path: "https://www.superfans.io/features" //String
})| Parameter | Type | Required | Description |
|---|---|---|---|
| path | String | yes | The complete URL to open (must begin with http:// or https://). |
Structure of Response
| Status | Response |
|---|---|
| Success | { "status": "success", "message": "Url opened successfully" } |
| Invalid Url | { "status": "error", "errorId": 400, "errorHandle": "invalid-url", "message": "Invalid url" } |
| Unexpected Error | { "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" } |
Example Usage
document.getElementById('openCartButton').addEventListener('click', () => {
VajroSDK.actions.openUrl({
path: "https://www.superfans.io/features" //String
})
});<div class="cart-container">
<button class="open-cart-btn" id="openCartButton">Visit our Website</button>
</div>.cart-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.open-cart-btn {
background-color: #28a745;
color: #fff;
border: none;
padding: 15px 30px;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.open-cart-btn:hover {
background-color: #218838;
}Best Practices
- Use HTTPS: Always prefer secure URLs (https://) for customer safety and trust.
- Keep users in-app: Use the default (in-app) setting for most pages to maintain session continuity.
- Track interactions: Log outbound link clicks for analytics or campaign tracking.
- Validate URLs: Ensure URLs are not empty or malformed before calling the action.
Caveats
- Internet dependency: Requires network connectivity; handle failures gracefully.
- No data return: The action does not return content from the URL — it only handles navigation.
- Unsupported protocols: Non-HTTP/HTTPS links (e.g., mailto: or custom schemes) are not guaranteed to work.
Updated about 1 month ago