The reCAPTCHA AJAX API
I will discuss the first method first.
Following the instructions of the first link and what I understood from reading the page, I used the html/script block they supplied:
<script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=your_public_key">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=your_public_key"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge">
</noscript>
I either can paste this (with the proper substitutions) in popup.html, or load a new tab containing the same block of code above (using chrome.tabs.create ({url:"comment_page.html"})) when a user clicks a "post" button in the extension's popup.html (the button's action being inserted by popup.js after the document loads). In both cases all I get rendered is the textArea object in the form.
Inspecting the error console of the page I can see:
"Refused to load script from 'http://www.google.com/recaptcha/api/challenge?k=6LfQQ9ESAAAAANwAZoEvBaCnQhXBdXxUOJ7YD0_g' because of Content-Security-Policy."
In my extension's manifest.json I have:
"permissions": ["*://*.google.com", "tabs", "comment_page.html", ...
So shouldn't it not be refusing to load script from 'http://www.google.com/recaptcha/api/....?
Also note that in the case that I load "comment_page.html" (package-local html page opened as a tab in above attempt) via file:///home/username/code/proj/commentextension/comment_page.html, since it isn't being associated with the Content Security Policy of my extension, it loads and displays the whole captcha fine.
In the second case, if I use the AJAX code
Recaptcha.create("your_public_key",
"element_id",
{
theme: "red",
callback: Recaptcha.focus_response_field
}
);
to attempt to insert a recaptcha into a div with a certain id in either my popup.html or a new tab, again fails with the same complaint about content security policy coming from some recaptcha-associated url which should be allowed, because of:"permissions": ["*://*.google.com",...
in manifest.json ?
I've not seen much discussion on this in some very extensive googling. Is there something totally fundamental I'm missing, making my whole quest for recaptcha in an extension totally ridiculous?