I have a web service that returns java script. The service is basically a wrapper around Google captcha service. It works simply including it in html code like following.
<body>
<script type="text/javascript" src="https://host/captchaservice/generate.htm?userName=me">
</script>
</body>
</html>
The service returns output which looks like this
var scripts=[]; scripts.push('https://www.google.com/recaptcha/api.js?hl=en'); for(src in scripts) document.writeln('<scri'+'pt src="'+scripts[src]+'" type="text/javascript"></sc'+'ript>') document.writeln('<div class="g-recaptcha" data-sitekey="12341234234asdf324f324rf34t23f341234"></div>')
Now I need to incude this captcha service in my JSF page.
- using
<h:outputscript>
you can only include local scripts - using it in separate script by using JQuery get call and use eval() on returned data does not work.
- Also need to paste it in exact location.
- -I can try using it in backing bean, but at the end I have to format the script in an html control.
There should be an easy way to do this which I am not probably aware of. BTW, I am using JSF 2.0.
Any help on this will be highly appreciated.