Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement recaptcha in expo web #56

Open
Davete0302 opened this issue Dec 7, 2021 · 0 comments
Open

Implement recaptcha in expo web #56

Davete0302 opened this issue Dec 7, 2021 · 0 comments

Comments

@Davete0302
Copy link

I'm trying to implement recaptcha but keep getting errors cannot read properties of undefined (reading 'postMessage')

import WebView from 'react-native-webview';

 const getWebviewContent = () => {
        var originalForm = '<!DOCTYPE html><html><head><script src="https://www.google.com/recaptcha/api.js"></script></head><body><form action="[POST_URL]" method="post"><input type="hidden" value="[TITLE]"><input type="hidden" value="[DESCRIPTION]"><input type="hidden" value="[URL]"><div class="g-recaptcha" data-sitekey="<site-key>"></div><input type="submit" value="Send"/></form></body></html>'
        var tmp = originalForm
            .replace("[POST_URL]", "http://localhost:19006/Contact")
            .replace("[TITLE]", 'title')
            .replace("[DESCRIPTION]", 'description')
            .replace("[URL]", 'http://localhost:19006/Contact');

        return tmp;

    }

 <WebView
     javaScriptEnabled={true}
     mixedContentMode={'always'}
     style={{ height: 500, width: 500 }}
     source={{
     html: getWebviewContent(),
     baseUrl: '<domain>' // <-- SET YOUR DOMAIN HERE
   }} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant