I'm attempting to run a test with and without the Geotrust SSL seal in my cart. I attempt to insert it by clicking in a white space area, and Insert HTML. I paste the code below, and then get this error after clicking Done.
TypeError: undefined is not a function (in function HTMLScriptElement, line 32, col 434)
<table width="135" border="0" cellpadding="2" cellspacing="0" title="Click to Verify - This site chose GeoTrust SSL for secure e-commerce and confidential communications.">
<a href="http://www.geotrust.com/ssl/" target="_blank" style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;"></a></td>
What's going on here?
Solved! Go to Solution.
This error most commonly pops up when you reference a function or variation in your code which is not yet defined when the page is loaded into the Optimizely editor. Alternatively, this error can appear if you reference a jQuery function which is not included in the version of jQuery included in the Optimizely snippet.
Saying that, I couldn't see anything in the code you are adding which would cause this to occur. I tried pasting the same code you provided into a sample experiment on my own account and did not see the error. If you could provide the experiment ID, though, I can take a closer look and let you know my findings.
I've taken a look at the experiment for you and have done a bit of research into why you're getting the error. The issue is the way you are adding the <script> element. Script elements need to be appended to the body or the head of a document rather than inside a div or similar element to prevent cross-scripting attacks. If you remove that portion of the code, you'll see that everything works a treat.
What I'd recommend is the following:
1. Remove the script element from the code snippet
2. Use jQuery's append() function to append the script to the head of the document, like so:
$("head").append( "<script>My script</script>");
You can test how everything in your experiment will look live by following the instructions in our support article on setting a test cookie. If things still aren't looking quite right after trying the above instructions, feel free to get back to me.
Hope this helps!
Unfortunately, this didn't work. I got the same error even after following your instructions and placing it in the global field. We ended up working around the issue by putting it into production, and then using Optimizely to remove the element from the page.