refine code, use cookie to crossdomain.