我们公司运营一个网站(oursite.com),其联盟合作伙伴向我们发送流量.在某些情况下,我们使用自己的子域名(affiliate.oursite.com)设置我们的关联企业,并使用iframe在我们的网站(affiliate.com)上显示所选内容.
他们网站上的页面示例:
<html>
<head></head>
<body>
<iframe src="affiliate.example.com/example_page.html">
...content...
[google analytics code for affiliate.oursite.com]
</iframe>
[google analytics code for affiliate.com]
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我们希望对affiliate.oursite.com进行Google Analytics跟踪.目前,从iframe加载页面时,Google似乎没有从联盟会员那里收到任何数据.
现在,存在安全隐患,因为Javascript不喜欢访问不同域中的页面的信息,并且IE不喜欢为不同的域设置cookie.
有人有解决方案吗?我们需要CNAME的affiliate.oursite.com到cname.oursite.com,还是有更清洁的解决方案?
我对Vue.js很新,我使用es6语法和vue-class-component.我在尝试从孩子向父母发出事件时遇到问题.我遵循默认的Vue.js语法的逻辑,但无法完成它.这里有一些更多的信息:
export default class HorizontalNavigation {
handleClick (e) {
e.preventDefault();
// console.log(e.target.dataset.section);
this.$emit('ChangeView', e.target.dataset.section);
}
render (h) {
return (
<div class={ style.horizontalNavigation } >
<div class='sections-wrapper'>
<div class={ style.sections }>
<ol>
<li><a on-click={ this.handleClick } href='#1' data-section='1' class='selected'>We are</a></li>
<li><a on-click={ this.handleClick } href='#2' data-section='2'>Services</a></li>
<li><a on-click={ this.handleClick } href='#3' data-section='3'>Cases</a></li>
<li><a on-click={ this.handleClick } href='#4' data-section='4'>Studio</a></li>
<li><a on-click={ this.handleClick } href='#5' data-section='5'>Career</a></li>
<li><a on-click={ this.handleClick } href='#6' data-section='6'>Contact</a></li>
</ol>
<span class='filling-line' aria-hidden='true'></span>
</div>
</div>
</div>
);
}
} …Run Code Online (Sandbox Code Playgroud) 有没有办法将JSON对象转储到文本文件中以便从Node服务器进行debuging?
我正在处理一个包含各种其他对象数组的非常大的JSON对象.
理想情况下,生成的txt文件应该像这样正确格式化
{
type: 'Program',
body: [
{
type: 'VariableDeclaration',
declarations: [
{
type: 'AssignmentExpression',
operator: =,
left: {
type: 'Identifier',
name: 'answer'
},
right: {
type: 'Literal',
value: 42
}
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
解:
var fs = require('fs');
var fs = require('fs');
var myData = {
name:'bla',
version:'1.0'
}
var outputFilename = '/tmp/my.json';
fs.writeFile(outputFilename, JSON.stringify(myData, null, 4), function(err) {
if(err) {
console.log(err);
} else {
console.log("JSON saved to ");
}
});
Run Code Online (Sandbox Code Playgroud) javascript ×3
cross-domain ×1
ecmascript-6 ×1
iframe ×1
json ×1
node.js ×1
tracking ×1
vue.js ×1