Automatically load script from Google
See original GitHub issueLoading recaptcha API from Google can easily be (and should be) automated.
Instead of requiring a user to insert this tag:
<script src="https://www.google.com/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer>
vue-recaptcha should simply run document.createElement('script')
in its mount()
and insert the script object to the document body. This will also fix “ReCAPTCHA couldn’t find user-provided function: vueRecaptchaApiLoaded” race condition.
The current architecture is not optimal in two perspectives:
- The developer needs to write extra code, and in some circumstances (e.g. with Nuxt or Ream) it’s not even clear where should this code go.
- Recaptcha API script will load even if it’s not used on a particular page.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How can I auto run script in Google sheet
In the Script Editor, under Edit, select "This project's triggers". Establish a trigger for that script. Done. Perfectly worked as I want.
Read more >Simple Triggers | Apps Script - Google Developers
Triggers let Apps Script run a function automatically when a certain event, like opening a document, occurs. Simple triggers are a set of ......
Read more >5+ ways to run Google Apps Scripts in Google Sheets
Google Apps Script enables you to extend Google Sheets and automate repetitive tasks. Once you write a script, you'll need to decide how...
Read more >How to automatically run code from Google Sheets script?
Hi there ! I am trying to run a script (in javascript) automatically. The trigger in the google app script do not work...
Read more >Run a Google apps script automatically upon loading a ...
The index.html file is an HTML file inside of the Apps Script code editor, as is the code.gs file also. The code.gs file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, this have been requested before. Because someone may need to custom the language of recaptcha, I thought that they have to load it by themself.
But for now, I have two proposal.
First one:
This one may also register the
vue-recaptcha
component also.I also imagine that maybe it will be possible to eliminate this feature as dead code when user only import
VueRecaptcha
component as named import. Because I like to keep all the thing small when it need to pass through the network and load inside the browser. But I don’t someone else will care about maybe only a few bytes overhead.Second one:
Which one do you prefer? Also I’ll mark this issue as
help wanted
and wait for some feedback. Because both of them will be a breaking changed IMO.@yariksav Current design will defer the loading until the first
vue-recaptcha
used. UsingVue.use
is just for some global config like language.