I'm attempting to use JavaScript to set a cookie that will instruct Google Translate to select the language for the page.
I've experimented with setting the cookie based on my browser's cookie selection of a language.
<script>
$(document).ready(function(){
setcookie("googtrans", "/en/fr", time()+3600, "/", "www.example.com");
setcookie("googtrans", "/en/fr", time()+3600, "/", ".example.com");
});
</script>
My knowledge of JavaScript is limited and I encountered an error message saying "unexpected token ILLEGAL." I'm not sure what this means:
<script>(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {ccm_exitVersionList()
};}}}})</script>
Could there be something incorrect in my script? Any assistance would be greatly appreciated.