Skip to content

Instantly share code, notes, and snippets.

@okunishinishi
Last active October 31, 2018 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okunishinishi/56e0dde10f06d76fd9dbf923177f88f8 to your computer and use it in GitHub Desktop.
Save okunishinishi/56e0dde10f06d76fd9dbf923177f88f8 to your computer and use it in GitHub Desktop.
Webページの認証を1行の記述だけでやってみる ref: https://qiita.com/okunishinishi@github/items/7353cd3d7f2cdae7ff4f
(prompt('合言葉は?') !== 'たこやき') && document.write('だめだこりゃ')
<html>
<body>
<h3>ようこそ!</h3>
<script>;(prompt('合言葉は?') !== 'たこやき') && document.write('だめだこりゃ')</script>
</body>
</html>
(localStorage.getItem('authorized') == 'YES' || (prompt('合言葉は?') === 'たこやき')) ? localStorage.setItem('authorized', 'YES') : document.write('だめだこりゃ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment