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

Several pages with reCaptcha #1

Closed
RoRElessar opened this issue Nov 14, 2018 · 3 comments
Closed

Several pages with reCaptcha #1

RoRElessar opened this issue Nov 14, 2018 · 3 comments

Comments

@RoRElessar
Copy link
Contributor

I use reCaptcha v3. On the website I have 2 pages with form, that include reCaptcha. When I visit the first page - reCaptcha works fine, but when I visit the second one by clicking the menu link (current location is the first page that contains the form with reCaptcha), recaptcha doesn't work. When I inspect the page, the reCaptcha's token input's value is absent. When I visit a page without the form, and then visit a page with form, reCaptcha works fine, the hidden field's value contains the token.

This is how I include the script on the page:

<%= content_for :recaptcha_js do %>
  <%= raw %Q{
        <script src="https://www.google.com/recaptcha/api.js?render=#{ENV['RECAPTCHA_SITE_KEY']}" data-turbolinks-track="reload"></script>
      } %>
<% end %>

Any ideas how to make it work? Thanks ahead.

@igorkasyanchuk
Copy link
Owner

I see that you have turbolinks.
does it work when you disable them completely?

@RoRElessar
Copy link
Contributor Author

RoRElessar commented Nov 14, 2018

I tried, but nothing changed.

EDIT:
Sorry, It seems I didn't remove turbolinks completely. When it was removed - reCaptcha began to work. But removing turbolinks is not an option, I'd like to use them in the project.

EDIT 2:
Had to add data-turbolinks="false" to my navigation links to make it work

@igorkasyanchuk
Copy link
Owner

@RoRElessar can you please make a PR and add a section with instructions on how to make it work with Turbolinks. It would be very useful.

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

2 participants