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'm trying to write Postman test and validate personal identification number with regexp. I have validated regexp: \b((([0-2]{1}[0-9]{1}|[3]{1}[0-1]{1})[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}(.|\n|\t|)[0-9]{5})|[3]{1}[2]{1}[0-9]{4}(.|\n|\t|)[0-9]{5})\b
Postman test script:
var req = JSON.parse(pm.request.body.raw);
pm.expect(req.personnumber).to.match( \b((([0-2]{1}[0-9]{1}|[3]{1}[0-1]{1})[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}(.|\n|\t|)[0-9]{5})|[3]{1}[2]{1}[0-9]{4}(.|\n|\t|)[0-9]{5}\b), "wwww" );
});
Postman returns following error while trying to execute test script:
There was an error in evaluating the test script: SyntaxError: Invalid or unexpected token
This error SyntaxError: Invalid or unexpected token comes from that you forgot about / in the beginning and end of regexp:
pm.expect(req.personnumber).to.match( /\b((([0-2]{1}[0-9]{1}|[3]{1}[0-1]{1})[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}(.|\n|\t|)[0-9]{5})|[3]{1}[2]{1}[0-9]{4}(.|\n|\t|)[0-9]{5}\b)/, "wwww" );
I have a webpage that shows a graph. It uses javascript, jquery, bootstrap and angular.js. In my android app I try to load this graph using a WebView. This is the code in the android.support.v4.app.Fragment.
WebView webView = (WebView) rootView.findViewById(R.id.webview_webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(getArguments().getString(MY_URL));
When I start the fragment, this is the log I get:
10-30 13:09:57.655: W/art(31893): Attempt to remove local handle scope entry from IRT, ignoring
10-30 13:09:57.659: W/AwContents(31893): onDetachedFromWindow called when already detached. Ignoring
10-30 13:09:57.796: W/cr.BindingManager(31893): Cannot call determinedVisibility() - never saw a connection for the pid: 31893
10-30 13:09:58.052: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/modernizr.js (1)
10-30 13:09:58.055: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.min.js (1)
10-30 13:09:58.057: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.gritter/js/jquery.gritter.js (1)
10-30 13:09:58.060: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.niftymodals/js/jquery.modalEffects.js (1)
10-30 13:09:58.062: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/masonry.js (1)
10-30 13:09:58.065: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.nanoscroller/jquery.nanoscroller.js (1)
10-30 13:09:58.068: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.ui/jquery-ui.js (1)
10-30 13:09:58.072: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.sparkline/jquery.sparkline.min.js (1)
10-30 13:09:58.074: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.easypiechart/jquery.easy-pie-chart.js (1)
10-30 13:09:58.077: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.nestable/jquery.nestable.js (1)
10-30 13:09:58.082: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap.switch/bootstrap-switch.min.js (1)
10-30 13:09:58.093: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap.datetimepicker/js/bootstrap-datetimepicker.min.js (1)
10-30 13:09:58.096: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap.clockpicker/js/bootstrap-clockpicker.min.js (1)
10-30 13:09:58.101: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.icheck/icheck.min.js (1)
10-30 13:09:58.104: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.select2/select2.min.js (1)
10-30 13:09:58.107: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.parsley/parsley.js (1)
10-30 13:09:58.109: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/skycons/skycons.js (1)
10-30 13:09:58.119: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap.slider/js/bootstrap-slider.js (1)
10-30 13:09:58.119: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/intro.js/intro.js (1)
10-30 13:09:58.119: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.maskedinput/jquery.maskedinput.js (1)
10-30 13:09:58.121: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.crop/dist/cropper.js (1)
10-30 13:09:58.123: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/datepicker/js/jquery-ui.js (1)
10-30 13:09:58.126: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/angular.min.js (1)
10-30 13:09:58.128: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/angular-ui-router.js (1)
10-30 13:09:58.133: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/angular-animate.min.js (1)
10-30 13:09:58.133: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/toaster.js (1)
10-30 13:09:58.305: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/infobox.js (1)
10-30 13:09:58.306: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/markerclusterer.js (1)
10-30 13:09:58.307: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/highstock.js (1)
10-30 13:09:58.308: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/exporting.js (1)
10-30 13:09:58.310: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/ng-highcharts.js (1)
10-30 13:09:58.311: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.upload/js/jquery.iframe-transport.js (1)
10-30 13:09:58.312: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.upload/js/jquery.fileupload.js (1)
10-30 13:09:58.315: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/behaviour/general.js (1)
10-30 13:09:58.317: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/behaviour/voice-commands.js (1)
10-30 13:09:58.319: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap/dist/js/bootstrap.min.js (1)
10-30 13:09:58.321: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.flot/jquery.flot.js (1)
10-30 13:09:58.323: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.flot/jquery.flot.pie.js (1)
10-30 13:09:58.324: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.flot/jquery.flot.labels.js (1)
10-30 13:09:58.326: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery.icheck/icheck.min.js (1)
10-30 13:09:58.328: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/ui-bootstrap-tpls-0.10.0.min.js (1)
10-30 13:09:58.329: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap/ui-bootstrap-tpls-0.10.0.js (1)
10-30 13:09:58.343: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/moment.min.js (1)
10-30 13:09:58.345: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jquery-ui/jquery-ui.custom.min.js (1)
10-30 13:09:58.349: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap-colorpicker.min.js (1)
10-30 13:09:58.352: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrap-timepicker.min.js (1)
10-30 13:09:58.354: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/bootstrapValidator.min.js (1)
10-30 13:09:58.355: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/jQuery-Storage-API/jquery.storageapi.js (1)
10-30 13:09:58.357: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/fullcalendar/dist/fullcalendar.js (1)
10-30 13:09:58.358: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/fullcalendar/appcalendar.js (1)
10-30 13:09:58.359: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/pt-br.js (1)
10-30 13:09:58.361: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/gcal.js (1)
10-30 13:09:58.362: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/LAB.min.js (1)
10-30 13:09:58.365: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/aside/angular-aside.js (1)
10-30 13:09:58.366: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//app/app/app.js (1)
10-30 13:09:58.368: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//app/app/data.js (1)
10-30 13:09:58.370: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//app/app/directives.js (1)
10-30 13:09:58.371: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//app/app/controllers.js (1)
10-30 13:09:58.373: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//app/app/modules.js (1)
10-30 13:09:58.374: I/chromium(31893): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: mydomain//js/sweetalert-master/dist/sweetalert.min.js (1)
As you can see, there is an "unexpected token <" error for each javascript file loaded in the page. I think this error maybe a mistake, because the page loads normally in any browser.
Have somebody seen this before? What can I try? Thanks.
Error was with file permissions in the server.
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.
calling the below function from html
displaySSHCmdResultDiv('12:21:08 up 4 days, 1:37, 3 users, load average: 0.44, 0.46, 0.44')
Throws me error "Uncaught SyntaxError: Unexpected token ILLEGAL " in chrome. can any one help me in identifying what the problem is .
As per your code function aruguments is 6 and its seprated by comma so you have complete single cot for each srting
displaySSHCmdResultDiv('12:21:08 up 4 days','1:37',' 3 users', 'load average: 0.44', '0.46', '0.44');