ExpressJS - Blocked by client - Unable to load js file? - javascript

I have loaded my express app on a server (I used heroku). When I test my app locally it works fine but when I load the page on the web it gives me a net::ERR_BLOCKED_BY_CLIENT saying that it is not able to load a JS file that I define in the HTML page:
<script src="./index.js"></script>
If I try to go to: http://<my-page>/index.js it is able to load the file successfully.
Why this doesn't work?
(If you need more information tell me what I need to add)

I finally solved my problem. There was a problem with the Avira Chrome extension that was blocking the file from loading. I simply added my page to the whitelist and it started working as supposed.

Related

TinyMCE - uncaught exception: module [5] returned undefined when using local javascript file

I am updating TinyMCE from 4.6.1 to 4.9.2 in my ASP.NET MVC application. I replaced the old tinymce.min.js file with the new one. When I run the app with IIS I get a console error and my textarea's do not display. The console error is, "uncaught exception: module [5] returned undefined".
If I replace tinymce.min.js with the original(4.6.1) it works again. If I use the second script tag below to get the externally hosted javascript file it works. I made sure the static file I have downloaded is the same exact file that I get from the second script tag. I also restarted the site in IIS.
#* this does NOT work with version 4.9.2, using version 4.6.1 works *#
<script type="text/javascript" src="#Href("~/js/tinymce/tinymce.min.js")"></script>
#* this works (4.9.2) *#
<script src='https://cloud.tinymce.com/stable/tinymce.min.js'></script>
My best guess is that the issue involves IIS. My IIS version is 10.0.16299.15.
EDIT: Also, I have confirmed that the javascript file is successfully fetched.
Make sure you include everything. I only included the main javascript file. If deploying locally make sure to download the full package. The self-hosted page on tiny.cloud was down when I was trying to get the files so I just grabbed the main js file.
The particular file I was missing was theme.min.js.

Can't load javascript file in localhost using xampp

I am new at web development and I want to upload a main.js scrip in my PHP file but it gives me this error
I used a script tag to upload the js file like this:-
<script type="text/javascript" src="../assets/js/main.js"></script>
This could be due to many things:
Check ad/script blocker
Check if the browser can load it from the view page source option
Try pasting it before all scripts call it could be due to some functions in previous scripts, I faced this issue before.
This might help.

Loading failed JavaScript file when deploy web application on weblogic

I have a problem with loading a JavaScript file on a jsp page when I deploy my web application on a weblogic server. Before I deployed it on Tomcat 7 and it worked normally.
First I see on console window of Firefox. My jsp page couldn't load js file on /resources/ folder (this folder is the same level with /WEB-INF/):
Loading failed for the <script> with source “http ://10.3.11.25:7001/resources/assets/global/plugins/jquery.min.js”. 10.3.11.25:7001:104
Image I have capture:
I tried copying the url: http ://10.3.11.25:7001/resources/assets/global/plugins/jquery.min.js to the address bar.
I can access it, but I only can download the js file (It not display the source code on browser as normally).
What is my problem? I deploy my web application on weblogic 12c.
UPDATE:
Network tab load js file ok, all status is 200:
Source code include on jsp:
<script src="resources/assets/global/plugins/jquery.min.js"
type="text/javascript"></script>
<script src="resources/assets/global/plugins/jquery-migrate.min.js"
type="text/javascript"></script>
UPDATE 2:
All status is 200 but load O KB and response is notthing
When I copy the js url to address bar it show popup download it (not display the source code as normally)
I have resolve my problem. My web application can't read the js file beacause have problem with MIME type on weblogic.
I add following mime mapping to web.xml and problem has been resolved:
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>js</extension>
<mime-type>text/javascript</mime-type>
</mime-mapping>

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.

Is it mandatory to mention protocol to load jQuery?

Below code,
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
<script type="text/javascript">
console.log(jQuery);
</script>
works fine in firefox browser after src is modified to "http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"(remote file) or "../js/jquery.min.js"(local file)
Otherwise, dev console gives Reference error: jQuery is not defined
I would like to test the code with remote library but not local
How do I understand this problem?
Leaving the scheme off the URL means that it is scheme relative.
If the HTML document is loaded over HTTP then the JS will be too.
If the HTML document is loaded over HTTPS then the JS will be too.
If the HTML document is loaded over FILE then … the JS won't be because file://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js doesn't exist.
Do your local testing on a local web server, don't load your HTML directly from your file system.
As mentioned by Mosh Feu, if you run a file locally, without a webserver, you cannot use protocol relative paths to load jQuery. That's because it is trying to find a local reference: file://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js.
Well, you could if you have jQuery locally in a folder /some/where/jQuery.js and you reference it with <script src="//some/where/jQuery.js>
So yes, if you're running pages from the disk directly, you must specify the protocol if you want jQuery from a CDN. See the first comment on http://www.paulirish.com/2010/the-protocol-relative-url/
Save yourself some trouble, install a local web server.
You must be viewing the file locally without using a web server which results in a wrong URL when the protocol is not explicitly specified.

Categories