HTML - browser error --> Can't find variable: Firebase - html

#jdv the error in the attached screenshot is being displayed in my browser's debugger
NOTE: Firebase DOES initializes in my command line - but my text editor will NOT accept the INITIALIZATION CODE (see code below). I love being challenged, but after 2 1/2 days of not finding a fix, I need help!
For some strange reason, config (in bold text below) is highlighted yellow in my text editor (I'm using brackets).
Here is some of my code:
<script src="/__/firebasejs/4.9.1/firebase-app.js"></script>
<script src="/__/firebasejs/4.9.1/firebase-auth.js"></script>
<script src="/__/firebasejs/4.9.1/firebase-database.js"></script>
<script src="/__/firebasejs/4.9.1/firebase-messaging.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My App Title</title>
<script src="/__/firebasejs/4.9.1/firebase.js"></script>
<script>
// Initialize Firebase
var **config** = {
apiKey: "myapi",
authDomain: "myappname.firebaseapp.com",
databaseURL: "https://myappname.firebaseio.com",
projectId: "myprojectid",
storageBucket: "myappname.appspot.com",
messagingSenderId: "mysenderid",
};
firebase.initializeApp(config);
</script>
Perhaps someone can tell me what I am doing wrong. I am brand new to coding, so I beg your pardon if this is an easy fix :) -lion
Still searching for a solution....
Here is a screenshot of my code:
Thanks for all the helpful suggestions :) -lion

You should use
<script src="https://www.gstatic.com/firebasejs/4.9.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.9.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.9.0/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.9.0/firebase-messaging.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.9.1/firebase.js"></script>
Instead of:
<script src="/__/firebasejs/4.9.1/firebase-app.js"></script>
<script src="/__/firebasejs/4.9.1/firebase-auth.js"></script>
<script src="/__/firebasejs/4.9.1/firebase-database.js"></script>
<script src="/__/firebasejs/4.9.1/firebase-messaging.js"></script>
<script src="/__/firebasejs/4.9.1/firebase.js"></script>

Related

Nu HTML Checker reports mysterious script tag

This seems to be a common problem: Stray start tag returned by the Nu HTML Checker. My HTML reads </body>, while the Checker says </body>↩<script>'undef. The only usage of <script> is as follows:
<script src="Sternheimer.js"></script>
<!--<script src="../jquery-2.1.4.min.js"></script>-->
<script src="../jquery-3.1.1.min.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$', '$']]
},
menuSettings: { inTabOrder: false }
});
</script>
<script type="text/x-mathjax-config">
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
MathJax.Hub.Config({
"HTML-CSS": { scale: 90 }
});
}
</script>
<script src="../MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="initializeForm.js"></script><!--run on page load-->
<script src="formFields.js"></script><!--reveal additional fields-->
<script src="../smoothScroll.js"></script>
<script src="../backToTop.js"></script>
... which is of course inside <head>. SO search results say the Checker could be misinterpreting comments, which I've checked by getting rid of <!--<script src="../jquery-2.1.4.min.js"></script>--> but the error persists. My markup is always validated using the W3C extension in Brackets. Please see the Nu result here. Any help resolving this mystery will be appreciated.
Update | Viewing the source on my hosting's server, I discovered the following was appended to my original markup: <script>'undefined'=== typeof _trfq || (window._trfq = []);'undefined'=== typeof _trfd && (window._trfd=[]),_trfd.push({'tccl.baseHost':'secureserver.net'}),_trfd.push({'ap':'cpsh'},{'server':'a2plcpnl0819'}) // Monitoring performance to make your website faster. If you want to opt-out, please contact web hosting support.</script><script src='https://img1.wsimg.com/tcc/tcc_l.combined.1.0.6.min.js'></script>. Mystery solved, and this appears to be fixable. Thank you for your help.
It is not a bug. I can type curl http://handcrafted.codes/Sternheimer/Sternheimer.htm and see the script tag after the body end tag.
Presumably you are using hosting which injects snoop code at the end of HTML documents.

bootstrap notify not working

I have written a simple example to demonstrate the use of bootstrap notify but its not working.
Below is my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="bootstrap-notify.js"></script>
<script src="bootstrap-notify.min.js"></script>
<script>$.notify("Hello World");</script>
</head>
<body>
</body>
Replace your script as below just add ready function it work fine. and also add bootstrap css for look good.
<script>
$(document).ready(function(){
$.notify("Hello World");
});
</script>

SAP UI5: object expected error in IE

i am using SAP UI5 and don't know why is it showing object expected in line 347 while running index.html file in ie.
<html>
<head>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<script src="resources/sap-ui-core.js"
type="text/javascript"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.ux3"
data-sap-ui-theme="sap_goldreflection" >
</script>
<script type="text/javascript" src="OPM_CM.js"></script>
<script>
sap.ui.localResources("opm");
var view = sap.ui.view({id:"OPM_CM1", viewName:"opm.OPM_CM", type:sap.ui.core.mvc.ViewType.JS});
//view.placeAt("content");
buildShell();
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
thanks in advance.
This may be happening because the sap object is not available.
<script>
function init(){
sap.ui.localResources("opm");
var view = sap.ui.view({id:"OPM_CM1", viewName:"opm.OPM_CM", type:sap.ui.core.mvc.ViewType.JS});
//view.placeAt("content");
buildShell();
}
window.addEventListener('load',init);
</script>
adding your code to a function and calling it on body onload may do the trick.
Note: please also give more details about the error you are getting.

google search won't open in new page

I expect the following code to open the results of a google search in new window but it doesn't. Does anyone have any suggestions?
<body>
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('001782268784890582031:k30dxi2nexc');
customSearchControl.setResultSetSize(google.search.Search.SMALL_RESULTSET);
customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_BLANK);
customSearchControl.draw('cse');
}, true);
</script>
<!--<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />-->
</body>
No, you misunderstood the meaning of google.search.Search.LINK_TARGET_BLANK
this code should produce following search results: links with target=_blank.
Search results though will show up in the same window.
for reference - please see:
http://code.google.com/apis/websearch/docs/reference.html

MooTools: Fx.slide couldn't get it worked

i am pretty new to mootools, i found it faster/smoother for animations than jquery so i decided to give it a try.
I don't get why the following code is not working, it is working on jsfiddle with Mootools core and Mootools more 1.3.1
<html>
<head>
<script src="mootools-more-1.3.1.1.js" type="text/javascript"></script>
<script src="mootools-core-1.3.1-full-compat.js" type="text/javascript"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
var myVerticalSlide = new Fx.Slide('paragraph', {mode:'horizontal'}) ;
$('v_slideout').addEvent('click', function(event){
event.stop();
myVerticalSlide.toggle();
});
});
</script>
</head>
<body>
<div id="paragraph">This is a paragraph.</div>
<a id="v_slideout" href="#">Test</a>
</body>
</html>
Can't seem to figure it out, i only could get it worked on jsfiddle.
Any suggestion is appreciated.
Edit: http://jsfiddle.net/F54s3/ << It doesn't work as it should in FF but still it does something, on Opera it seems fine though.
I might have messed up the code as i am pretty new to it, but i am trying to figure out why it works on jsfiddle and doesn't work on my index.html.
The order of your script includes looks suspicious to me:
<script src="mootools-more-1.3.1.1.js" type="text/javascript"></script>
<script src="mootools-core-1.3.1-full-compat.js" type="text/javascript"></script>
Shouldn't the mootools-core file come first?
For example:
http://jsfiddle.net/AxJq9/ (throws Javascript error)
<script src="http://mootools.net/assets/scripts/mootools.more.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools.js" type="text/javascript"></script>
http://jsfiddle.net/AxJq9/1/ (doesn't throw an error)
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools.js" type="text/javascript"></script>
<script src="http://mootools.net/assets/scripts/mootools.more.js" type="text/javascript"></script>