I have a strange issue when trying to load some JS and CSS files.
I have an ASP.NET MVC Web Project and inside it I have Index.html and ask to load some script files. I believe it is important to mention that I rewrited the URL in Web.config so instead of showing me something like : localhost:2064/Index.html to show localhost:2064/ or localhost:2064/Index/.
I use the normal "call" for my scripts like:
<link href="/Content/bootstrap.min.css" rel="stylesheet" />
<link href="/Content/Site.css" rel="stylesheet" />
<script src="Scripts/jquery-1.10.2.min.js" ></script>
<script src="Scripts/bootstrap.min.js" ></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/modernizr-2.6.2.js" ></script>
<script src="Scripts/Layout/menu.js" ></script>
But, in console I get some errors (Chrome Inspector Console):
Uncaught SyntaxError: Unexpected token < :2064/Scripts/jquery-1.10.2.min.js:1
Uncaught SyntaxError: Unexpected token < :2064/Scripts/bootstrap.min.js:1
Uncaught SyntaxError: Unexpected token < :2064/Scripts/bootstrap.js:1
Uncaught SyntaxError: Unexpected token < modernizr-2.6.2.js:1
Uncaught SyntaxError: Unexpected token < menu.js:1
Uncaught SyntaxError: Unexpected token < app.js:1
Uncaught SyntaxError: Unexpected token < indexController.js:1
Uncaught SyntaxError: Unexpected token < homeController.js:1
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.6/$injector/modulerr?p0=PBA&p1=Error%3A%20%…F1.2.6%2F%24injector%2Fnomod%3Fp0%3DPBA%0A%20%20%20%20at%20Error%20(native...<omitted>...4) MINERR_ASSET:22
When I inspected to see the content of those files I get the following info:
STATUS: 304 Not Modified
CONTENT: Same as my HTML file (not as expected).
Any help? Thanks in advance.
It looks to me that your rewrite logic is wrong.
If you analyze your errors you will see that each javascript file has a '<' character on the first line. That indicates to me that you are probably serving one of your html files instead of the actual javascript files.
Also make sure you are serving each file with a proper content type, ie 'text/javascript', 'text/html', etc.
Related
Has anyone experience the following JavaScript syntax error inside a JavaScript file for a cookie alert and have a solution to it? I am getting the error code below.
SyntaxError: Unexpected token ':' at https://*******.com/assets/web/assets/cookies-alert-plugin/cookies-alert-script.js:16:447 at new Promise (<anonymous>) at b (https://*******.com/assets/web/assets/cookies-alert-plugin/cookies-alert-script.js:16:167) at https://***********.com/assets/web/assets/cookies-alert-plugin/cookies-alert-script.js:17:142
I am facing issue Js Uncaught SyntaxError PHP Website
Details of query :
URL is http://www.matoshreenisarg.com/about-us/dg
This URL should be redirected to 404 but this is not redirecting appearing inspect console error
*Uncaught SyntaxError: Unexpected token <
bootstrap.min.js:1
Uncaught SyntaxError: Unexpected token <
revolution.min.js:1
Uncaught SyntaxError: Unexpected token <
jquery.fancybox.pack.js:1
Uncaught SyntaxError: Unexpected token <
isotope.js:1
Uncaught SyntaxError: Unexpected token <
owl.js:1
Uncaught SyntaxError: Unexpected token <
jquery.gmap.js:1
Uncaught SyntaxError: Unexpected token <
jquery.easing.min.js:1
Uncaught SyntaxError: Unexpected token <
masterslider.js:1
Uncaught SyntaxError: Unexpected token <
wow.js:1
Uncaught SyntaxError: Unexpected token <
script.js:1
Uncaught SyntaxError: Unexpected token <*
use
/
in every external script/css call
For Example
src="/js/jquery.js" instead of src="js/jquery.js"
href="/css/style.css" instead of href="css/style.css"
I have a Gruntfile, which setups a Connect Server, and I'm trying to add mod_rewrite module (https://www.npmjs.com/package/connect-modrewrite) to add some rules.
Basically, What I need to do, is to add a rewrite for all '^/invite/(.*)$ to the root of my site.
For that I have this config in my Gruntfile.js:
...
middleware: function (connect) {
var middlewares = [];
middlewares.push(modRewrite(['^/invite/(.*)$ / [L]']));
middlewares.push(connect.static(appConfig.app))
return middlewares;
}
...
The route seems to work, since if I check on the inspector, the html of the root page is there.
However, I get this message:
(index):1 Uncaught SyntaxError: Unexpected token <
What is wrong?
EDIT
Errors:
this.webSocket = new WebSocket(this.consumer.url);
when i ran my project i received this error on this line in file action_cable.self
please ask for any further code if needed.
I am new to Jade and I am having some problems with the Scripts.
In some of them, I get Unexpected Token errors... this is one example:
script
$(document).ready({
$('#answer').keyup(function(e) {
$('#preview').html($('#answer').val());
});
});
This should work fine in common HTML, but with Jade it says:
Uncaught SyntaxError: Unexpected token (
Do I have to use any special syntax with Jade?
Thanks.
In jade, script should be followed by .(dot)
like => script. (or) script(type="text/javascript").