Why is my WebView not executing JavaScript even after I have set javaScriptEnabled={true}?
Why is my WebView not executing JavaScript even after I have set javaScriptEnabled={true}?
Let me help you search for information about WebView and JavaScript issues with THETA camera applications.
Found 37 results for 'webview javascript react native theta status:public'
Based on your question about WebView not executing JavaScript even after setting javaScriptEnabled={true}
, I see you’re trying to work with WebView in React Native, likely for displaying 360° content. This is a common issue that can have several causes. Let me help you troubleshoot this.
Here are the key things to check:
<WebView
source={{ uri: 'your-url' }}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
scalesPageToFit={true}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
allowFileAccessFromFileURLs={true}
/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
source={{ uri: 'file:///path/to/your/file.html' }}
// or
source={require('./path/to/your/file.html')}
<WebView
injectedJavaScript={`
// Your JavaScript code here
true; // note: this is required
`}
onMessage={(event) => {
console.log(event.nativeEvent.data);
}}
/>
Looking at successful implementations in our community:
Here’s a working example with Pannellum viewer: HowTo: React Native with Pannellum 360 Viewer
Another successful implementation with Marzipano: HowTo: Marzipano Free 360 Image Viewer with React Native and WebView
If you’re still having issues, could you:
This will help me provide more specific guidance for your use case.