code_junkie

Can I use localhost as the domain when setting an HTTP cookie

Nov 13th, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. $(function() {
  2.  
  3. console.log('Testing');
  4.  
  5. var one = $.cookie('Test.One');
  6. var two = $.cookie('Test.Two');
  7. var three = $.cookie('Test.Three');
  8.  
  9. console.log(['one', one]);
  10. console.log(['two', two]);
  11. console.log(['three', three]);
  12.  
  13. $('#div1').text(one);
  14. $('#div2').text(two);
  15. $('#div3').text(three);
  16.  
  17. $.cookie('Test.One', 'Test 1');
  18. $.cookie('Test.Two', 'Test 2', { path: '/' });
  19. $.cookie('Test.Three', 'Test 3', { path: '/', domain: 'localhost' });
  20.  
  21. });
  22.  
  23. var domain = (options.domain && options.domain !== 'localhost') ? '; domain=' + (options.domain) : '';
Add Comment
Please, Sign In to add comment