首页 > 解决方案 > 从响应中隐藏部分 javascript 代码

问题描述

您好我有一个包含模板的 js 文件。

data["isShowEdit"] = isShowEdit;
smartScreen.template = {
        showAction: _.template("<div class=\"SmartScreenDesignAction\"  >" +
                               "<% if (isShowEdit) { %> <a href=\"#\" class=\"btn btn-xs btn-default smartScreen-edit\" rel=\"{{id}}\"><i class=\"fa fa-pencil\"></i></a>&nbsp;<% } %>" +
                               "<a href=\"#\" class=\"btn btn-xs btn-default smartScreen-delete\"rel=\"{{id}}\" ><i class=\"fa fa-trash-o\"></i></a>" +
                                       "</div>"),
showActionColumn: _.template("<div class=\"SmartScreenDesignInputAction\">" +
                               "<a href=\"#\" class=\"btn btn-xs btn-default smartScreen-delete\" rel=\"{{id}}\"><i class=\"fa fa-trash-o\"></i></a>" +
                                       "</div>")

我的问题是可以在响应中看到代码的第一部分(showAction:_template isShowEdit 部分)。我希望这部分只出现在后端,因为它会导致安全漏洞。

回复

我怎样才能隐藏这部分。提前致谢。

标签: javascripthtmlasp.nettemplates

解决方案


推荐阅读