标签:
昨天遇到要求,要在asp文件中注入一段js代码,感觉不难,不过搞了挺久的,最后结果居然如此简单。。。
1 protected void Page_Load(object sender, EventArgs e) 2 { 3 string js = "\n<script type=‘text/javascript‘>window.BWEUM||(BWEUM={});BWEUM.info = {\"stand\":true,\"agentType\":\"browser\",\"agent\":\"tpm.oneapm.com/static/js/bw-send-411.4.3.js\",\"beaconUrl\":\"tpm.oneapm.com/beacon\",\"licenseKey\":\"eI~J7AnJrnQQzemU\",\"applicationID\":1325648};</script><script type=\"text/javascript\" src=\"//tpm.oneapm.com/static/js/bw-loader-411.4.3.js\"></script>"; 4 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OneAPM", js); 5 }
此段代码用于插入OneAPM的监控处理,数据统计(顺便给OneAPM打打广告。。。)
标签:
原文地址:http://www.cnblogs.com/ArrowTip/p/CSInjectionJS.html