我的应用程序中包含JavaScript脚本,包含JavaScript和jQuery函数.所有用户与我的应用程序的交互都是动态的,它通过jQuery传递给应用程序.
我意识到,当我在客户端运行我的应用程序时,客户端可以通过查看页面源(Ctrl + U)来查看我的所有源代码.
如何隐藏或执行某些操作以便用户无法理解或阅读源代码?
我想做像Facebook那样的事情.通过查看Facebook源用户无法重用其源代码甚至无法理解它.
我用Google搜索并发现这个过程称为混淆,但这对我不起作用.
我试过这个:
http://www.javascriptobfuscator.com/default.aspx
和
http://dean.edwards.name/packer/
和
http://www.daftlogic.com/projects-online-javascript-obfuscator.htm
甚至我试过 http://www.jasob.com/
但这对我没用.
我有一个javascript函数
function relativeTime(time) {
var period = new Date(time);
var delta = new Date() - period;
if (delta <= 10000) { // Less than 10 seconds ago
return 'Just now';
}
var units = null;
var conversions = {
millisecond: 1, // ms -> ms
second: 1000, // ms -> sec
minute: 60, // sec -> min
hour: 60, // min -> hour
day: 24, // hour -> day
month: 30, // day -> month (roughly)
year: 12 // month …Run Code Online (Sandbox Code Playgroud) 用于获取城市自动填充文本框的自动填充文本框.
我的代码看起来像这样,
<input id="location" type="text" name="q"
data-autocomplete="@Url.Action("locationSearch", "Home",
new { text = "location" })"/>
Run Code Online (Sandbox Code Playgroud)
现在我想将其转换为剃刀syntex.我尝试了这个,但没有工作.
@Html.TextBoxFor(model => model.Location,
new { data-autocomplete = Url.Action("locationSearch", "Home")})
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个?
我必须将值从视图传递给控制器,控制器具有将调用webmethod以将值设置为数据库的操作方法.我怎样才能做到这一点?
我有一个视图,从数据库中获取值,并有一个注释链接.点击评论一个textarea框将打开并提供一些输入后.将点击"确定"按钮.
点击按钮确定我正在打电话
$('a.comment').livequery("click", function (e) {
var getpID = $(this).parent().attr('id').replace('commentBox-', '');
var comment_text = $("#commentMark-" + getpID).val();
//alert(getpID);
//alert(comment_text);
if (comment_text != "Write a comment...") {
//$.post("/Home/SetComment?comment_text=" + comment_text + "&post_id-= " + getpID, {
}, function (response) {
$('#CommentPosted' + getpID).append($(response).fadeIn('slow'));
// $("#commentMark-" + getpID).val("Write a comment...");
$("#commentMark-" + getpID).val();
});
}
Run Code Online (Sandbox Code Playgroud)
现在我该怎么做才能将getpId和comment_text值赋予控制器SetComment动作?
我正在研究asp.net mvc3应用程序.
在这个用户可以发布数据,我使用textarea进行输入.这些数据存储在数据库中,我使用razor @ Html.DisplayFor()检索它.
我的textarea数据是这样的(由用户输入)
Oh woooah, oh woooooah, oh wooooah, oh.
You know you love me, I know you care,
you shout whenever and I’ll be there.
You are my love, you are my heart
and we will never ever ever be apart.
Are we an item? girl quit playing,
we’re just friends, what are you saying.
Said there’s another, look right in my eyes,
my first love broke my heart for the first time.
And I was …Run Code Online (Sandbox Code Playgroud)