React-native – Is there a way to force the webview link Click outside?

I have a WebView component that loads static HTML content:

 style={{flex : 1))
html={content}
/>

The problem is that if someone clicks on the link, it will open in the app, I would rather force it to use the link in Safari Open in. Is that possible?

After searching a bit, I see that the only way to open the browser from the RN application is Use Linking or LinkingIOS API. Then the question is how to make your Webview able to use the API. There are two possible solutions:

1) Register your own that is handled by your application URL scheme. For example. to myApp: //this/is/a/link.html. Then process all incoming events of the scheme and make corresponding calls to the API. The registration plan is simple and the effect is very good. This is for me Said seems to be the most powerful method.

2) Use a library to let Webview directly talk to its paren view. For example. https://github.com/alinz/react-native-webview- bridge. Then put some JS code in the page, onClick sends the link URL to the parent view, and then calls the API. I just used that project and it worked as a charm until I needed an RN upgrade to break it. But It is still under active development, so you should be fine.

I have a WebView component that loads static HTML content:

 style={{flex: 1}}
html={content}
/>

The problem is that if someone clicks on the link, it Will open in the app, I would rather force it to use a link to open in Safari. Is that possible?

After searching a bit, I saw that the only way to open the browser from the RN application is to use Linking or LinkingIOS API. So the question is, how to make Your Webview can use this API. There are two possible solutions:

1) Register your own URL scheme handled by your application. For example. For myApp: //this/ is/a/link.html. Then process all incoming events of the program and make corresponding calls to the API. The registration plan is simple and works well. This seems to be the most powerful method to me.

2) Use a library to let Webview directly talk to its paren view. For example. https://github.com/alinz/react-native-webview-bridge. Then put some JS code in the page, onClick sends the link URL to the parent view, and then calls the API. I just used that project and it worked as a charm until I needed an RN upgrade to break it. But it is still under active development, so you should be fine. < /p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5928 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.