凡客誠品のドメインを越えてcookiesを取得する方法
6337 ワード
大丈夫な時に凡人のトップページを伏せて研究しました。凡人のjsコードの中でcookiesを得る方法を発見しました。基本原理は凡人のserver端にページ出力cookies文字列を提供します。clientはjsop形式でこのcookies文字列を取得します。
プログラムのデモンストレーション
あなたも自分のマシンで試してみてもいいです。でも、まず一般のお客さんに口座番号を持ってから、効果が見られます。
次の段落は凡人の中の一つのドメインを越えてcookiesを取得する関数です。
このページのデモ効果に使うコードは以下の通りです。
ここに記録します。
プログラムのデモンストレーション
あなたも自分のマシンで試してみてもいいです。でも、まず一般のお客さんに口座番号を持ってから、効果が見られます。
次の段落は凡人の中の一つのドメインを越えてcookiesを取得する関数です。
function setWelcome() {
$.getScript("http://my.vancl.com/Usercenter/GetUserName.ashx", function() {
if (typeof (data) != undefined && typeof (data) != "undefined" && data != "") {
$("#login").html("<a class='top' href='https://login.vancl.com/login/UserLoginOut.aspx' target='_parent' > </a>");
$("#welcome").html(" ,<a class='top' href='http://my.vancl.com/' >" + data + "</a>。<a class='top' href='https://login.vancl.com/Login/UserLoginOut.aspx?'" + window.location.href + " target='_parent' > </a>");
}
else {
return;
}
}
);
このページのデモ効果に使うコードは以下の通りです。
<div style="text-indent:2em;"><input type="button" value=" " id="render" /></div>
<script type="text/javascript">
// <![CDATA[
document.getElementById('render').onclick=function(){
$.getScript("http://my.vancl.com/Usercenter/GetUserName.ashx", function()
{
if (typeof (data) != undefined && typeof (data) != "undefined" && data != "")
{
alert(" :"+data);
}
else
{
alert(" !");
return;
}
});
}
// ]]>
</script>
ここに記録します。