Skip to content

Instantly share code, notes, and snippets.

@flipjs
Created May 5, 2019 17:56
Show Gist options
  • Save flipjs/889bfa8354bb192f73e707f79db2d5b0 to your computer and use it in GitHub Desktop.
Save flipjs/889bfa8354bb192f73e707f79db2d5b0 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/nufumuz
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
console.log('hello world!')
localStorage.setItem('hello', 'world')
document.cookie = 'appType=legacy; path=/; domain=jsbin.com'
document.cookie = 'hello=world;path=/;domain=jsbin.com'
document.cookie = 'foo=bar; path=/; domain=jsbin.com'
console.log('======'+document.cookie+'==========')
//if (document.cookie.match(/\bappType=legacy;?\b/)) {
if (document.cookie.match(/\bappType=legacy;?\b/)) {
try {
document.cookie = 'appType=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=jsbin.com'
document.cookie = 'hello=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=jsbin.com'
console.log('success!')
} catch (e) {
console.log('ERROR:', e)
}
} else {
console.log('cookie NOT found!')
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.log('hello world!')
localStorage.setItem('hello', 'world')
document.cookie = 'appType=legacy; path=/; domain=jsbin.com'
document.cookie = 'hello=world;path=/;domain=jsbin.com'
document.cookie = 'foo=bar; path=/; domain=jsbin.com'
console.log('======'+document.cookie+'==========')
//if (document.cookie.match(/\bappType=legacy;?\b/)) {
if (document.cookie.match(/\bappType=legacy;?\b/)) {
try {
document.cookie = 'appType=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=jsbin.com'
document.cookie = 'hello=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=jsbin.com'
console.log('success!')
} catch (e) {
console.log('ERROR:', e)
}
} else {
console.log('cookie NOT found!')
}</script></body>
</html>
console.log('hello world!')
localStorage.setItem('hello', 'world')
document.cookie = 'appType=legacy; path=/; domain=jsbin.com'
document.cookie = 'hello=world;path=/;domain=jsbin.com'
document.cookie = 'foo=bar; path=/; domain=jsbin.com'
console.log('======'+document.cookie+'==========')
//if (document.cookie.match(/\bappType=legacy;?\b/)) {
if (document.cookie.match(/\bappType=legacy;?\b/)) {
try {
document.cookie = 'appType=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=jsbin.com'
document.cookie = 'hello=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=jsbin.com'
console.log('success!')
} catch (e) {
console.log('ERROR:', e)
}
} else {
console.log('cookie NOT found!')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment