假设我有一个名为的网站a.com,当加载此网站的特定页面时,比如页面链接,我喜欢为另一个被调用的网站设置一个cookie b.com,然后将用户重定向到b.com.
我的意思是,在加载时a.com/link我想为其设置一个cookie b.com并将用户重定向到b.com.
我测试了它,浏览器实际上收到了cookie a.com/link,但它没有在重定向请求上发送该cookie b.com.这是正常的吗?
我们可以为其他域设置cookie吗?
使用Mongoose.js带node.js.
我有这个架构:
var Photo = new Schema({
URL:String
,description:String
,created_by:{type:ObjectId, ref:'User'}
,created_at:{type:Date, default:Date.now()}
});
var User = new Schema({
name:{type:String,index:true}
,email:{type:String,index:true, unique:true}
});
//Task model
var Task = new Schema({
title:String
,created_by:{type:ObjectId, ref: 'User'}
,created:{type:Date, default:Date.now()}
,responses:[{
type:Number
,user:{type:ObjectId, ref: 'User'}
,comment:String
,avatarURL:String
,photo:{type:ObjectId, ref: 'Photo'}
,created:{type:Date, default:Date.now()}
}]
});
//Group model
var Group = new Schema({
name:String
,tasks:[Task]
});
Run Code Online (Sandbox Code Playgroud)
并且这个代码错误输出(组很好,idx上的任务很好,响应是一个空数组,用户有效,照片有效):
var typePhoto = 6;
var resp = {
type: typePhoto//photo
,user: user._id
,photo: photo._id
}; …Run Code Online (Sandbox Code Playgroud) 我有以下自定义标记/指令:
<tile class="ng-scope gridster-item" tilevalue="1" gridster-item="tile" row="0" col = "0" ng-repeat="tile in selectedTiles"> </tile>
Run Code Online (Sandbox Code Playgroud)
我创建了一个键盘控件,其目标是关注selectedTiles array每个键盘事件中的每个tile("tile"指令)(shift + right arrow).
// Keyboard Tile Navigation
//Starting pos
var curIndex = -1
//keyboard control
$(document).keydown(function(event) {
if (event.shiftKey && event.which === 39) {
console.log("right");
focusNext();
}
});
function focusNext() {
focusTile(+1);
}
function focusTile(delta) {
var visibleTiles = $scope.selectedTiles;
var elem = $("[gridster-item='tile']");
curIndex = curIndex + delta;
el = elem[curIndex];
el.attr('tabindex', -1).focus();
el.css("border-color", "yellow");
}
Run Code Online (Sandbox Code Playgroud)
当我得到变量的控制台日志时,elem我得到了dom中出现的tile数组(如预期的那样).问题是当我尝试添加一个 …
我正在尝试确定用户区域设置日期格式,以便以后可以使用它以特定格式显示日期。
我知道我可以toLocaleDateString()用来获取日期格式。
假设我得到了1/2/2017. 如何确定这是dd/mm格式还是mm/dd格式?
我尝试过的一件事是我可以从中获取当前日期和月份,new Date()并根据它(手动)进行检查。日期是什么时候2/2/2016或者3/3/2016如何确定哪个是日期哪个是月份?
有没有人对这个问题有任何解决方案?
我也调查过moment.js。如果那里也有一些解决方案,我会很乐意使用它。
我有一个文本字段.
<input type="number" min="0" max="999">
Run Code Online (Sandbox Code Playgroud)
但我可以在文本框中输入尽可能多的数字.
当我设置max = 999时,我不希望发生这种情况.有谁知道这个的解决方案?我曾尝试ng-maxlength和maxlength,但不起作用.