I recently deployed my website to GitHub Pages - https://max-stevenson.github.io/my-year-in-books/
I have a two local JavaScript libraries (jQuery and swiped-events) downloaded and within the following directory: src/public/js/lib.
In my index.html file at the root directory, I am linking to the two libraries like so:
<script type="text/javascript" src="/src/public/js/lib/jquery-3.4.1.min.js"></script>
<script src="/src/public/js/lib/swiped-events.js"></script>
But when I access the page on GitHub Pages I get the following errors:
GET https://max-stevenson.github.io/src/public/js/lib/jquery-3.4.1.min.js net::ERR_ABORTED 404 (Not Found)
GET https://max-stevenson.github.io/src/public/js/lib/swiped-events.js net::ERR_ABORTED 404 (Not Found)
When I run a local instance on my machine via a node express server and visit the site at localhost:3000, everything works great.
Can anyone please advise me where I'm going wrong and how to correctly reference my scripts so that they are loaded in GitHub Pages?
Try:
<script type="text/javascript" src="/my-year-in-books/scr/js/lib/jquery-3.4.1.min.js"></script
Or:
<script type="text/javascript" src="./scr/public/js/lib/jquery-3.4.1.min.js"></script
Related
I'm attempting to implement push notifications in a reminder app I'm building. I am attempting to follow along to the way it is done in this demo project. To that end, I added a razor class library project entitled BlazorReminders.ComponentsLibrary to my BlazorReminders solution. Just as the BlazingPizza project did, I put the localStorage.js and pushNotifications.js files under the wwwroot folder of the ComponentsLibrary project. I then added a reference to the ComponentsLibrary in the client project and attempted to load the resources in the client's index.html file as follows:
<script src="_content/BlazorReminders.ComponentsLibrary/localStorage.js"></script>
<script src="_content/BlazorReminders.ComponentsLibrary/pushNotifications.js"></script>
This is the exact way they did it in the demo project, however for me it returned a "Failed to load resource: the server responded with a status of 404 ()".
A more detailed console message
GET https://localhost:44304/_content/BlazorReminders.ComponentsLibrary/pushNotifications.js net::ERR_ABORTED 404
I've also tried changing the src path to variations of "..\BlazorReminders\BlazorReminders.ComponentsLibrary\wwwroot\pushNotifications.js" to no avail; I got the same errors.
What could be causing the 404? Thanks
EDIT: Resolved
Thanks to agua from Mars for pointing out that I had forgotten to update the these package references in my ComponentsLibrary project file
//Version had to be changed to 3.2 preview
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.2.0-preview2.20160.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.2.0-preview2.20160.5" />
Running my ROR app with Puma locally. Getting the following error trying to load javascript/application.js
Failed to load resource: the server responded with a status of 404 (Not Found) javascript/application.js
Keep in mind this was a Ruby 1.9.3 app that I just updated the GEM file to 2.3.1
Does anything need to be changed when running a Rails app locally?
The source code shows
<script src="/javascripts/application.js"></script>
<link href="/bootstrap.min.css" rel="stylesheet">
<link href="/bootstrap-responsive.min.css" rel="stylesheet">
Locally, javascript files should be under app/assets/javascripts. They will be compressed, minified and copied into public during assets compilation (deployment)
Looks like there's no js files under /public/javascripts hence the 404 error you are getting.
It's also worth checking that you are starting the app in development mode. Otherwise, rails will look into public for js and css files.
See https://guides.rubyonrails.org/asset_pipeline.html#asset-organization for more details.
As I can see in my projects there is this kind of path
/assets/js/...
but maybe earlier was diffrent convetion.
Do you use static assets or dynamic on local ?
The Javascript works on localhost but not the live server, and I can't figure out how to address the path.
Head section:
<script type="text/javascript" src='js/modernizr.min.js'></script>
At the bottom:
<script type="text/javascript" src='js/jquery.min.js'></script>
<script type="text/javascript" src='js/script.js'></script>
On live server the console shows these errors:
Failed to load resource: the server responded with a status of 404
(Not Found) - /js/isotope.min.js (and similar 17 times)
Content pages are not able to reference the functions in any of the .js files, the browser is looking for a separate file instead reading it from the script.js. What did I do wrong?
I am new to NodeJs and WebStorm. I have created a new "Node.Js Express App" using ejs template. I have created a Scripts folder inside my app root directory and trying load those files on my index.ejs file inside views folder.
When I run page in Chrome, it gives the following 404 error. For example, in my index.ejs body tag file, if I say:
<script type="text/javascript" src="Scripts/jquery.min.js"></script>
It will give following error:
"Failed to load resource: the server responded with a status of 404 (Not Found)"
I works fine in public folder by why it doesn't work if scripts and files are outside the public folder?
I installed my CI application on a remote server (an OpenShift install). I have Javascript files included in the view headers. When I try to access the application, all the Javascript files are stuck in "GET" (looking at firebug Net console) and spin endlessly. Am I missing some specification? Here is an example of what I have in the view header file within the head tags
<script src="<?php echo base_url('js/jquery-1.8.2.js');?>"type="text/javascript" charset="utf-8"></script>
Thanks!
Mmiz
Turned out that the base_url in applications/config needed to specify https instead of http: which is what I had. This might be an OpenShift deployment thing but it did solve my problem!