2

I am familiar with the injectJs and includeJs calls, in relation to PhantomJS/CasperJS. But, how do I add external Javascript with the following form:

<script src="https://www.google.com/recaptcha/api.js" async defer></script>

Please note the two parameters "async" and "defer". Thanks.

2
  • Why do you care about async and defer? This shouldn't make any difference when injecting. Also, there is a good chance that the injection happens after the page loaded Commented May 14, 2017 at 12:35
  • It's required of Google's Javascripts that rely on these parameters. Commented May 14, 2017 at 16:13

1 Answer 1

1

I couldn't figure out how to insert valueless attributes as I defined in my original question with PhantomJS / CasperJS. But it turns out, Google reCAPTCHA JS SDK works as intended if I do insert the value "true" to the two attributes. So, I injected the two attributes as:

<script src="https://www.google.com/recaptcha/api.js" async="true" defer="true"></script>

and it worked fine, even though their document only has the valueless attributes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.