Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Created July 15, 2019 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jirawatee/edc7fe0d89300e6c5023550b24a83110 to your computer and use it in GitHub Desktop.
Save jirawatee/edc7fe0d89300e6c5023550b24a83110 to your computer and use it in GitHub Desktop.
Sign in before link Rich menu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rich Menu Demo</title>
<style>
body { margin: 0; padding: 20px }
input { width: 90%; height: 32px; display: block; margin: 0 auto }
input[type=text], input[type=password] { padding: 16px; font-size: 24px }
input[type=button] { width: 100%; height: 48px }
</style>
</head>
<body>
<table width="100%" cellspacing="8">
<tr><td><input type="text" name="username" placeholder="Username" required></td></tr>
<tr><td><input type="password" placeholder="Password" required></td></tr>
<tr><td><input type="button" value="Submit" id="post"></td></tr>
</table>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"> </script>
<script src="https://d.line-scdn.net/liff/1.0/sdk.js"></script>
<script>
window.onload = function (e) {
liff.init(function (data) { initializeApp(data); });
}
function initializeApp(data) {
jQuery("#post").click(function () {
jQuery.post(
"https://<YOUR-PROJECT-ID>.cloudfunctions.net/RichMenu",
{ uid: data.context.userId },
function (responseText) { liff.closeWindow();},
"html"
);
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment