cloud9 ide - error 'Firebase is not defined' in online IDE (Firebase javascript client script-tag included) -
i'm trying follow web quickstart on firebase found here stuck on step 2.
i set new webpage on cloud9, using html5 template, following basic conent:
<html> <head> <script src="https://cdn.firebase.com/js/client/2.4.0/firebase.js"></script> </head> <body> "hallo" <script> var firebase = require("firebase"); var myfirebaseref = new firebase("https://resplendent-heat-2801.firebaseio.com/"); myfirebaseref.set({ title: "hello world!", author: "firebase", location: { city: "san francisco", state: "california", zip: 94103 } }); </script> </body> </html>
if don't add line var firebase = require("firebase");
error
'firebase not defined'.
if add line error:
'uncaught reference error: require not defined.
i tried use nodejs template , run command $ npm install firebase --save
in terminal. result shows in terminal:
firebase@2.4.0 node_modules/firebase
└── faye-websocket@0.9.3 (websocket-driver@0.5.2)
(so installing firebase seems work) , add page of code doesn't make difference.
how solve issue? not have option install nodejs locally (working on schoolcomputer).
remove require
. firebase loads correctly cdn.
make sure check security tab , add appropriate rules write operations.
<html> <head> <script src="https://cdn.firebase.com/js/client/2.4.0/firebase.js"></script> </head> <body> "hallo" <script> //var firebase = require("firebase"); var myfirebaseref = new firebase("https://resplendent-heat-2801.firebaseio.com/"); myfirebaseref.set({ title: "hello world!", author: "firebase", location: { city: "san francisco", state: "california", zip: 94103 } }); </script> </body> </html>
Comments
Post a Comment