how to avoid pops up in react native webview .?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



how to avoid pops up in react native webview .?



I have a webview and I want to block popups while user is moving from page to page ,by popup I mean Ads that belong to the site that I am calling inside source of webview.
could you please help me on that, this is how I am building my webview :


<WebView
source=webapp
ref="WEBVIEW_REF"
onNavigationStateChange=this.onNavigationStateChange
style=webView
renderError=this.handleRenderError
onError=this.handleRenderError
onLoad=this.handleOnLoadEnd
renderLoading=this.renderLoading
startInLoadingState
javaScriptEnabled=true
domStorageEnabled=true
decelerationRate="fast"
/>



I have added some code to prevent these popsup , it didn't wrok


...
injectedJavascript=jsCode

const jsCode = 'document.querySelectorAll("iframe").setAttribute("sandbox", "allow-forms allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation");';





There's not much info to go on here...
– evolutionxbox
Aug 8 at 10:15





what popups are you referring to? are these popups made in react-native or these belong to web?
– Aseem Upadhyay
Aug 8 at 10:16





You need to show the source code of the webview and ads you are talking about. You might be able to do something with the injectedJavascript prop
– Kevin Amiranoff
Aug 8 at 11:08





I have edited my post
– salmanaacvf
Aug 8 at 11:14









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard