简体   繁体   English

禁用从c#/ asp.net运行的脚本

[英]disable script running from c#/asp.net

Hello I want to disable this script for twitter widget to be displayed on some pages. 您好,我想禁用此脚本,以便在某些页面上显示twitter小部件。 How can I access the script from the backend and change the url on runtime? 如何从后端访问脚本并在运行时更改URL?

<script id="twitter" src="http://widgets.twimg.com/j/2/widget.js">

Thanks in advance 提前致谢

That's not really possible.. modern browsers will leave the code in memory even if you remove the script tag from the DOM itself. 这实际上是不可能的。现代浏览器会将代码保留在内存中,即使您从DOM本身中删除了脚本标签也是如此。

The only way around I can think of is to "overwrite" the object/functions: in the bottom of the page have your own script defining exactly the same functions and objects like that script, except they will be null/empty so the final result is like removing the script. 我能想到的唯一方法是“覆盖”对象/函数:在页面底部,您自己的脚本定义了与该脚本完全相同的函数和对象,只是它们将为空/空,因此最终结果就像删除脚本一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM