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

Warning: localhost detected when loading hCaptcha from Apache Cordova browser platform #5

Open
andreszs opened this issue Jul 15, 2024 · 0 comments

Comments

@andreszs
Copy link

I've developed an hCaptcha Cordova plugin alongside a demo app for both android and browser plaforms and it works fine.

In android it loads the hcaptcha SDK 4.0.0 correctly.

However, since I failed to bundle this vanilla-hcaptcha JS plugin for the browser platform (which is fine with running on localhost), the plugin dynamically loads the regular JS from js.hcaptcha.com to render the widget. Consequently, the warning about running on localhost is triggered whenever the hCaptcha widget is shown:

image

Since this is the Cordova browser platform, it runs from localhost by default and there's no (straightforward) way to change this. The hCaptcha challenge works, and the token can be validated nonetheless, but it would be nice to get rid of this console error message.

PRs are welcome to add the missing iOS platform or switch the JS served from js.hcaptcha.com to a locally bundled JS file.. I've tried using the plugin.xml source-file option to bundle the vanilla-hcaptcha JS without success, probably because I'm not very good at developing advanced cordova plugins (nor is chat GPT which assisted me on this, and don't even try asking Gemini).

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