1

Here is my code:

<cfscript language="javascript">
      OpenText(document.getElementById(#url.id#));
</cfscript>

Here is the error:

Invalid token l found on line 731 at column 19.

The CFML compiler was processing:

A cfscript tag beginning on line 731, column 10.

Why?

2 Answers 2

11

<cfscript> doesn't take a language attribute. You are probably just wanting to do:

<script type="text/javascript">
<cfoutput>
OpenText(document.getElementById(#url.id#));
</cfoutput>
</script>

Incidentally, the language attribute is also deprecated on the <script> tag in HTML 4, and you should use type instead (as in my example). In HTML5 you can just do <script> without either language or type attributes.

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

1 Comment

Dumping client-provided values direct to page enables JS injection - should be doing document.getElementById('#JsStringFormat(url.id)#') (or in CF10/equiv encodeForJavaScript).
4

OpenBD supports this apparently, but ColdFusion does not.

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.