Guest User

Untitled

a guest
Jan 22nd, 2018
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>demo</title>
  5. </head>
  6.  
  7. <body>
  8.  
  9. <script src="https://www.gstatic.com/firebasejs/3.6.3/firebase.js"></script>
  10.  
  11. <script>
  12. // Initialize Firebase
  13. var config = {
  14. apiKey: "AIzaSyCW-lP25n8nxq4OuOAaV1PE1rLW_u5GBnw",
  15. authDomain: "fir-f4a5f.firebaseapp.com",
  16. databaseURL: "https://fir-f4a5f.firebaseio.com",
  17. projectId: "fir-f4a5f",
  18. storageBucket: "",
  19. messagingSenderId: "356303445704"
  20. };
  21. firebase.initializeApp(config);
  22. </script>
  23.  
  24. <script type="text/javascript">
  25.  
  26. var messaging = firebase.messaging();
  27. messaging.requestPermission().
  28. then(function () {
  29. console.log("hello world");
  30. return messaging.getToken();
  31. })
  32. .then(function (token) {
  33. console.log(token);
  34. })
  35. .catch(function (err) {
  36. console.log("error occured");
  37. })
  38.  
  39. </script>
Add Comment
Please, Sign In to add comment