WebView injectedJavaScript window scope


#1

I have a WebView with a local html file

<WebView
  source={require('../../../index.html')}
  injectedJavaScript={'alert(window.test);'}
/>

index.html has a JS file included, inside which a value is assigned to window.test

<script type="text/javascript" src="./index.js"></script>

On a local expo setup this works, but when the files are served from cloudfront window inside injectedJavaScript does not equal to window inside the index.js file. window.test is undefined
inside injectedJavaScript


#2

Was able to go around this by including the content of index.js inside a


closed #3

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.