Created
September 14, 2016 10:20
-
-
Save volpeo/054af66d430cd518ba12ffdc65a34bfb to your computer and use it in GitHub Desktop.
Redirect from a satellite static website to application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create cookie at sign in | |
cookies[:redirect] = { | |
:value => 'yes', | |
:expires => 1.year.from_now, | |
:domain => '.mydomain.com' | |
} | |
# delete cookie at sign out | |
cookies.delete :redirect, domain: '.mydomain.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.3/js.cookie.js"></script> | |
<script> | |
var redirect = Cookies.get('redirect'); | |
if (redirect == "yes") { | |
window.location.href = "http://app.mydomain.com"; | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Should be redirected if connected on the app</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment