For detailed information on all parameters, examples, and requirements, visit: Parameter Documentation
3. Navigation Suppression and URL Handling
All navigation requests within the WebView MUST be suppressed
to prevent external links from opening within the WebView. Instead, use the post message bridge to handle URL opening in the native browser.
Required Implementation:
Suppress Navigation: Configure your WebView to prevent all navigation requests
Post Message Bridge: Implement JavaScript message handling to catch URL opening requests
window.sovApi="v1";// Post Message Bridge: Handle URL opening requests from Sovendus content// This prevents navigation within the WebView and opens URLs in native browserwindow.addEventListener("message",(event)=>{if(event.
Platform-Specific Navigation Suppression:
iOS (WKWebView): Return .cancel in decidePolicyFor navigationAction
Android (WebView): Return true in shouldOverrideUrlLoading()
Other platforms: Use equivalent navigation prevention methods
4. Implement Dynamic Height Adjustment
Dynamic Height Management Required:
The WebView height must dynamically adjust based on content size to provide optimal user experience.
Standard Implementation:
// Height Management: Monitor content size changes and notify native codenewResizeObserver(()=>{const height =document.body.scrollHeight;// Send height to native code for component resizing// Implementation depends on your platform's JavaScript bridgeconsole.log
Implementation Notes:
Only apply height updates > 100px to avoid layout issues
Ensure your JavaScript bridge properly handles height update messages
5. Add Input Sanitization
Security Requirement
Always sanitize user input data before inserting it into the HTML template to prevent XSS attacks. Use JSON encoding for all string values.
6. Implement Error Handling
Add comprehensive error handling for:
WebView loading failures
JavaScript execution errors
Network connectivity issues
Invalid parameter values
🔧 Key Implementation Requirements
Navigation Suppression
All navigation requests within the WebView MUST be suppressed
to prevent external links from opening within the WebView. Configure your WebView to cancel/prevent all navigation attempts and handle URLs via the post message bridge instead.
Post Message Bridge for URL Handling
URL Opening Pattern:
The integration uses a post message bridge to handle URL opening:
Sovendus content sends messages via window.postMessage() with channel "sovendus:integration"
JavaScript listener catches these messages and forwards them to native code
Native code receives the message and opens the URL in the default browser
Dynamic Height Management
Height Adjustment Pattern:
The WebView height must dynamically adjust based on content:
ResizeObserver monitors changes to document.body.scrollHeight
Height changes are sent to native code via your platform's JavaScript bridge
Native code updates the component height and triggers layout update
Only heights > 100px should be applied to avoid layout issues
🔧 Implementation Features
Security
XSS Prevention: All user input must be properly sanitized
Content Security: Restrict WebView navigation and file access
Error Handling: Implement proper error logging to your application's logging system
Performance
Memory Management: Properly dispose of WebView resources