Css background url path not working in node.js app - javascript

I have a problem finding the correct image path, the only similar question I could find on SO was left unresolved and uses the same technologies.
css background url not working in express
The whole app is done in node.js, I am using express for the routing.
I have the contact.html file, this will later be an ejs file, but I think this does not matter for now.
I have the CSS inline in the contact.html file, all in a style tag.
Tried all the paths, ../,/,./ etc, I always get this is the console:
GET http://127.0.0.1:3000/checks.png 404 (Not Found)
I find this very odd, when I use an absolute path, it all works, here is a screenshot of all the folders visible and the CSS part.
Can anyone tell me why this is? Especially the weird console error message is bugging me>-)

Related

fonts.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) in laravel

I have an error loading the font awesome icons (not shown) in my project with the laravel framework, inside the css folder I have two backend_css folders where I wait for all css styles and in the other frontend_css folder I have it empty, the problem is that it doesn't load the awesome font icons version 5.2.0 in my template.
It seems that I have the wrong directory at the time of calling the fonts.min.css file, eh checked and I still can't find the error. help xf
try use
urls:['/css/backend_css/fonts.min.css']
It's a good practice always use absolute path.
Post your code instead of screenshot so that others can copy your code and check it.

Can't use absolute URL in a Javascript file?

I am trying to use the following script for a halloween effect tomorrow : https://auz.github.io/Bug/
The problem is that it keeps searching for the files in the HOME directory (mysite.com/fly-sprite.png)
I am using wordpress multisite and have all sorts of changes in my htaccess file.
Despite changing imageSprite: 'fly-sprite.png' to 'mysite/flysprite.png' I am still stuck with console 404 errors pointing to the home directory to look for these files.
How can I edit the Javascript to use an absolute URL?
https://jsfiddle.net/3pfcdb97/

Why isn't my stylesheet page working when using handlebars(javascript)?

When working on a handlebars demo, I am noticing that the stylesheet does not show up when viewing the page. I have provided links to the code and the live page below. Does anyone know why the stylesheet isn't working?
The code is here:
https://github.com/sutri001/DA670/tree/master/week7_handlebars
The live page is here:
http://67.205.184.187:1000
Your rendered page does have the link tag that references the stylesheet you're looking for. What's happening is your server is throwing a 404 when a request is made for the stylesheet.
Looking at the code for your express server, I see you're telling express to serve files staticly from the public directory (good)... but you don't have a public directory, and even more your css directory is located outside of such a place.
My advice is to move your css directory into a new public directory (so you'll have public/css/style.css). That should resolve your issue.
Also, remember that it's the browser that's handling your link tags, not the server! That means browsers are currently trying to go to http://yoursite/../../css/style.css. Thankfully your browser understands how to handle this, but this is definitely not what you want.
Your link tag's href attribute should be set to /css/style.css because, from the browser's perspective, that's where the stylesheet is located.

Why can't I get my script tag src's to work?

I have been coding up a localhost, and I made the localhost by using of course a JavaScript file to do so, and I then made it reference an HTML file. However, I noticed that when I am using localhost to serve up the HTML file I get this error:
"GET http://localhost:3333/filetesting.js"
The filetesting.js is that js file, there are also other things I'm referencing too, like websites. I'm referencing it by using script tag src.
I looked at the network on developer tools of it and it says it's a 404 error not found. I'm trying to figure out how to reference my script tag src's without having localhost:3333 go before it.
When I run the HTML file without using the localhost, it works just fine when it comes to the script tag src's. If you do not entirely understand what I'm asking for, just ask.
Assuming that your script will always reside in the root level of your website, you can simply target it with the root-relative prefix /:
<script src="/filetesting.js"></script>
This will load your script from the root, regardless of the site the file is hosted on. For example, on http://localhost:3333/ it will load the file from http://localhost:3333/filetesting.js, and from http://localhost:3333/folder/, it will attempt to load the file from the same location.
If you move your files over to a proper website, it will still work the same way: www.example.com will look for the file at www.example.com/filetesting.js, and www.example.com/folder/ will look for the same file at www.example.com/filetesting.js.
Hope this helps! :)

Why my site isn't fully functioning on public domain (in the world wide web)?

I made a simple website. The site is fully functionable in my localhost (my computer). Everything working fine here.
But problem arises when I upload the files into the web server in order for running that in public domain. There, no content is showing except the layout. No link or tab is working, no paragraph inside the body is displaying. You may have a look here.
For what reason?
I uploaded all the files (with source code) associated my website except the images and videos (since there are a lots of images and I will upload it a bit later).
[NOTE: I have xampp local server installed in my computer. All the
sourse codes files are stored inside the htdocs folder. Inside the
htdocs folder I have a folder named jquery(which was installed with
the package). I saved my .JS file inside the JQuery folder (since I
used jquery code too). So when I upload file into the server do I need
to upload the whole htdocs folder? Or how about the JQuery folder
(which contains the JQuery source code)? Do I also need to upload it?
My paths set are the following:
C:\xampp\htdocs\jquery [contains the whole project's source file]
C:\xampp\htdocs\jquery\js [Contains only JavaScript&JQuery file]
If you inspect your page and look where you expect the content to be, you'll find <div id="home">. Looking at the CSS for this, it shows line 258 of your css file has this:
#all_contents >div {
display:none;
}
This is causing all of your contents to not display. Removing this will fix the problem.
Also, if you look on the browser's console when your page loads, you'll notice a lot of 404s trying to load various scripts, stylesheets, and images. That's potentially contributing to the problem. I'd focus on fixing those first, to make sure everything is loading properly.
I tried debugging the HTML on your website. I found the following code in design.css at line number 258
#all_contents >div {
display:none;
}
Once you remove this(display:none), all the content is available on the website link that you shared.
Also, I am not sure why this is working on your local. Are you sure that you have uploaded the same version which is running in your local?
You can debug your webpage by pressing F12 and then selecting the problematic area. On the right hand side, you can see the css rules associated with the selected element.
For getting the specific content in a page and not all, create a new file by the name who_im.html and put your content over there and then You should do something like
About Me
Like this you will have to make other pages as well and add the hyper links to the menu in every page.

Categories