I have included a bootswatch theme in my website.
<!-- Bootstrap CSS served from a CDN -->
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" integrity="sha384-zF4BRsG/fLiTGfR9QL82DrilZxrwgY/+du4p/c7J72zZj+FLYq4zY00RylP9ZjiT" crossorigin="anonymous">
<!-- Scripts -->
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
The problem is that bootstrap.min.css file loads twice. I can see it twice in resources when I open developer console on any browser. It is the same file because I can see that it is loaded by the same html line. Because of this, when I want to close a collapse or a menu, it just closes and opens again fast. I have no idea why it loads twice. How can I fix this?
I can think about two reason for your issue---
No.1
You have a plugin that uses bootstrap and it is loading the additional cdn.
No.2
You are adding some include file in your page which have the bootstrap cdn inside it. Hence your main page loads two bootstrap cdn.
Suggestion
Try removing bootstrap cdns from the bootswatch theme. As I am assuming that your website has already bootstrap cdn included in it.
I know it's a old thread, but I was searching for the same and also found the answer.
Remove integrity attribute from the url and it downloads only once.
This new attribute integrity attribute which I think is what makes the browser to call the cdn the first time to check that the file is not manipulated and then the second call happens to load the file.
Somehow it is flawed and should not download twice.
Related
So I created a web app using visual studio .net core 3.1. I see that boostrap came with it by default. So what I did was copy and paste the accordion example from bootstrap and was expecting it to work by default but it is not rendering. I double checked and see that jquery is referenced before boost strap. I checked the css and JS file and it is loaded, and there is no error in the console. Is there something else I need to do?
Update:
This is where I got the sample code, it is the very first example: Bootsrap example
You can open bootstrap.js in your project,you will find the version of bootstrap is v4.3.1,and you are referencing the official document of bootstrap v5.0,so you need to add the css and js of v5.0.
You can try to add the css and js of v5.0 to your _layout.cshtml.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
I created a Vue 3 web app, featuring Vuex, Vue Router, etc, and I have filled out the manifest and set up PWA features as well. I noticed that in production my favicon is not loading, and the default browser icon is applied.
I checked the "Elements" tab in the Chrome dev tools to find that the reference to my favicon has been wrapped in this if statement for internet explorer.
Example:
<!--[if IE]><link rel="icon" type="image/x-icon" href="/resources/icons/favicon.ico" /><![endif]-->
I have also referenced the icon in my manifest, and given it many options for sizes, even though I only have one size file right now. (256x256)
the "public" folder is working as expected, eg. I can navigate to myapp.com/resources/icons/favicon.ico which returns the file successfully after the build.
When the PWA is installed, it does use the correct sized images from the manifest, installing on Chrome both on desktop and mobile seem to show the icon fine, though those are different assets.
Should I only specify the favicon in index.html or in the manifest instead of both? Is there a setting somewhere in the manifest or in my Vue app that is triggering this "IE if" statement to be applied?
I am still not too keen on this manifest business or with PWAs in general, but I want to create a good client experience, so any information you can point me to would be very appreciated.
Thank you.
I have a photo gallery that has it's own .css and .js file. I'd like to be able to add those to only the gallery page. They server no purpose anywhere else on the site. How I do this in BigCommerce? I can't seem to find the gallery page I created in their file system.
As far as I know, it's not considered best practice, but if you are using the HTML5 Doctype specification, e.g:
<!DOCTYPE html>
Your css doesn't need to be in the of your site. You could add your link to the top of your custom gallery page. If you're adding them through the html editor while editing a page, I believe a relative file path will work for those assets, such as:
<link rel="stylesheet" href="/template/Styles/yourfile.css" />
<script src="/template/Styles/yourfile.js"></script>
If you create a custom page template file you can check the documentation on referencing assets in a theme.
Both files will need to have been uploaded via webdav.
Turns out this is not going to be possible without major edits to the existing CSS but thanks for the help.
I'm trying to make a simple page with bootstrap and glypicons in jsf 2.2. I've included webjar's bootstrap dependency (and opening the jar I can see the fonts file are present).
When deploying the app to wildfly, bootstrap css works correctly, but icons shown are horrible (like a default font or something). Looking at the network tab in the browser, I only see 404 errors:
http://localhost:8080/proto/javax.faces.resource/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.woff 404
http://localhost:8080/proto/javax.faces.resource/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.ttf 404
I tried including the other dependency (bootstrap-glypicons) and I only get the 404 errors twice. What am I missing?
This is how I'm including boostrap, which works correctly for css:
<h:outputStylesheet library="webjars" name="bootstrap/3.1.1/css/bootstrap.min.css" />
And this is how I'm using the css classes:
<button><span class="glyphicon glyphicon-minus"></span></button>
You should use <link> tag instead of <h:outputStylesheet>
eg.
<link rel="stylesheet" type="text/css" media="all" href="webjars/bootstrap/3.1.1/css/bootstrap.min.css"/>
--- UPDATE
This happen because ResourceHandler in JSF add library value (webjars) to the end of URI as a parameter:
faces/javax.faces.resource/bootstrap/3.1.1/css/bootstrap.min.css?ln=webjars
in bootstrap.min.css CSS there are such references to files:
url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
so if you want to use <h:outputStylesheet> you can write own ResourceHander or you can edit bootstrap.min.css and fix paths to glyphicons-halflings-regular.* files
In my opinion is better to use standard html tag <link> instead of <h:outputStylesheet> because JSF component tree will be smaller and it act on performance. Inside bootstrap.min.css there is no EL so there is no need to use <h:outputStylesheet>
Small update: webjars has JSF specific versions of several CSS libraries, in case of the bootstrap CSS the following will work just fine:
<h:outputStylesheet library="webjars" name="bootstrap/3.3.5/css/bootstrap-jsf.css" />
Note the -jsf suffix.
I am trying to integrate DOJO to my existing struts application.
Listed below are the steps I followed.
1.Downloaded DOJO 1.4, copied dijit,dojo and dojox folders under my application folder jsp->js>DOJO
copy paste "dialog via mark up example" (http://www.dojotoolkit.org/reference-guide/dijit/Dialog.html#dijit-dialog)
When I run the application, I am getting javasript error dojo undefined.
What I am missing?
Also where is dojo.xd.js? I don't see it under dojo folder
You are probably missing a reference to the dojo script on your page.
http://www.dojotoolkit.org/reference-guide/quickstart/install.html#quickstart-install
You need to add a <script src="path to where you put dojo"></script> to your page.
Simple alternative is to use the DOJO from CDN - Content Distribution Network (Multiple repositories which has all dijit,dojo and dojox folders . So you don't have to copy anything). Use the following code if you want to use the latest DOJO.
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"></script>
If you want a specific version, then
<script type="text/javascript" src="http://o.aolcdn.com/dojo/<version>/dojo/dojo.xd.js"></script>