How to prevent Coldfusion from injecting cfform.js into the head section?

亡梦爱人 提交于 2019-12-10 14:16:04

问题


An HTML template is passed to Coldfusion. The head tag of the template has additional attribute:

<head profile="http://abc.com">

The issue is that when generating the output based on this template Coldfusion injects its scripts inside the head tag:

<head <script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
profile="http://abc.com">

This causes profile="http://abc.com"> to appear on the top of the page and prevents page from validation.

The code injection occurs only when there is a form tag. The wrong-place injection does not happen if the head tag does not have any attributes. The presence of the attribute is a project requirement and cannot be omitted.

Is it possible to prevent Coldfusion from injecting the scripts?


回答1:


The script injection only happens for cfforms, not standard forms. If you aren't using any of cfform's enhancements, you can simply switch to a standard form.

I checked the cumulative hotfix list, and didn't see a fix for this.




回答2:


My Solution: Put the meta tag right after the

<html>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<head>

when CF creates the page it puts the tag below the but above the tags

<!DOCTYPE html>
<html class=" ext-strict">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script type="text/javascript">/* <![CDATA[ */_cf_loadingtexthtml="<img alt=' ' src='/CFIDE/scripts/ajax/resources/cf/images/loading.gif'/>";
_cf_contextpath="";
_cf_ajaxscriptsrc="/CFIDE/scripts/ajax";
_cf_jsonprefix='//';
_cf_clientid='9851DA49BD375D9722A9D6B1951976AC';/* ]]> */</script><<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>


来源:https://stackoverflow.com/questions/1477266/how-to-prevent-coldfusion-from-injecting-cfform-js-into-the-head-section

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!