GO - html file can't load external js file - javascript

I have a GO project which has UI written by html. In HTML file, I have written javascript, and I can install GO and load the UI successfully.
The problem is when I move those javascript code to an external file, and include it: . I only can build GO, but when load the UI, it has error 404 Not Found which is "myscripts.js" file. The weird thing is on its header of error:
Remote Address:127.0.0.1:8080
Request URL:http://localhost:8080/subscribe/myscripts.js
Request Method:GET
Status Code:404 Not Found
Please help, I can't find any answer yet for this

That's normal if you only define handler for your endpoints.
You should add to your router the http.FileServer handler pointing to the directory that store your project files.
Additionally, think about the <base> that to define the root of your relative links, which will prevent errors such as path nesting.

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.

Failed to load resource: the server responded with a status of 409

After an automatic WordPress update the plugin forms (Contact Form 7) now display a slash just below them and are no longer firing the wpcf7mailsent listener event, so it is no longer being redirected to the thanks page after submitting the form.
This error: “the server responded with a status of 409 or also known as net :: ERR_ABORTED 409” from what I see is a problem loading styles.css and scripts.js files.
This must be the reason why it is not issuing the wpcf7mailsent listener event and a slash just below the forms.
Strangely if on the same page I manually click and open the styles.css file via URL, the file starts to load on the page and it stops showing that bar just below the form.
For this reason I am saying that you are not loading the styles.css and scripts.js files, as they do not even appear in the uploaded files folder, just after I open them by URL.
Here’s the test I did to show it:
The error happening:
https://ibb.co/Vvm8jwG
Did not load CSS file and JS file:
https://ibb.co/kHszgW9
After I open the CSS style link that says it didn’t load:
https://ibb.co/FXcLRXQ
https://ibb.co/997nMgK
You no longer see the error that you did not upload the CSS file and now the file has been uploaded to the folder showing the contents. The same will happen with the JS file if I manually load it as the CSS file.
https://ibb.co/jGPQ2MH
https://ibb.co/chVjRTQ
What I already tried to do to fix, but it didn’t work:
– I disabled several plugins
– I updated the plugin
– I reinstalled the plugin
– I tested in other browsers, the error persists
Other sites with Contact Form 7 are also experiencing the same.
Environment Settings:
Theme: Javelin
WordPress: 5.2.4
PHP: 7.1.24
Hosting: Hostgator
The page I need help with: https://verdecia.com.br/central-de-atendimento/
For anyone who is facing this issue, this is a known issue in bluehost and hostgator hosting. Basically the root reason for this seems to be that they are blocking image/js/css or other assets in any path with contact string.
The reason that contact form 7 assets are randomly blocked is probably also due to this same reason.
I had html websites running on my server where contact (or any other) page with assets in for example /images/contact/ folder also did not load with 409 conflict error, due to the contact path in the assets folder.
Unfortunately I found no solution to this just like many many users out there. Check out these links:
Link 1
Link 2
What is the solution?
Well wasting time with hosting provider support is of no use. I just use
hostgator/bluehost for development purpose. There are many hosting providers out there,
so next time you can choose some other one, especially for live websites.
For custom websites, avoid naming your assets folder to anything that has contact in it.
For CF7 in wordpress stop loading the assets in wp-config file using define( 'WPCF7_LOAD_JS', false ); define( 'WPCF7_LOAD_CSS', false ); and manually load the files in the header by separately downloading the files and importing them.
EDIT:
I have been using a simpler fix recently when using CF7, just rename the plugin folder from contact-form-7 to anything without contact keyword, like cf7. This will start loading all assets without the conflict.

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! :)

Failed to load resource from gstatic.com/charts

I use gstatic.com/charts to load graph to the web page.
But several days ago the webpage gave error
GET https://www.gstatic.com/charts/current/css/util/util.css
In network tab it shows that util.css is not loaded.
Checked via Incognito- the same problem.
Any ideas?
The problem was:
The JS is connected via 'https://www.gstatic.com/charts/loader.js'. From the JS file the CSS files are uploaded via the URL, written in that JS file.
I downloaded that JS file to include it locally, however they changed the URL of css file and this problem occured.
For me it helped to include the JS file via the above URL.

Categories