I am doing an experimental HTML template wich comes with jquery.min.js file - one of the most popular javascript libraries.
When I load the template from my local hard drive it works fine.
When I upload it and load it from server (GWAN) I get error (I think is not the only one) in Chrome looks like this:
Uncaught SyntaxError: Unexpected token { jquery.min.js:3
I inspected a bit and realized there is a
function $
which was turned into
function$
by GWan. The space removed is causing an error in Chrome, Firefox and Safari. I haven't tested other browsers but my IDE also reports a syntax error in the downloaded from GWAN version of the JS file.
I have also tried uploading the files to another server (Apache) and no problem there. The js file was not modified...
Any clues on how to get over this? I suppose there is a bug in javascript on-the-fly optimization of GWan?
Thanks.
It's a known issue and it will be fixed in next release (soon)
You'll be able to disable minifying directly from a init.c script in G-WAN v4.10+, this way:
u8 *www_mini = (u8*)get_env(argv, USE_MINIFYING);
if(www_mini)
{
*www_mini = 0;
puts("> disable minifying");
}
You just have to wait for few days for the new v5 release.
Related
I have a WASM project. I have a site.js file in the wwwroot/js folder.
I already had a javascript function here and it works fine.
I added two new functions:
function LoadLog(logValue) {
logTa = document.getElementById("logTextArea")
logTa.value = logValue;
ScrollLogToBottom()
}
function ScrollLogToBottom() {
logTa = document.getElementById("logTextArea")
logTa.scrollTop = logTa.scrollHeight;
}
The WASM project would error out when calling these functions, and I went into debug mode.
When I looked at the site.js file - these functions were not present. The other function was present, but these were not. The file is saved (it saves automatically when you run anyway but I double checked it).
This is the debug view:
This is the file in Visual Studio:
As you can see, the Download file appears in the debugger fine - but the rest...not so much.
Is there something I am missing here?
As a further update - I deleted the Download function. I cleaned my solution. I rebuilt my solution, and then ran the solution.
The DownloadFile function was still in the js file - without the other functions...it appears as if the JS file is not being updated.
Further Further update - I deleted the entire JS folder from the Solution, and from the location on my hard drive.
When I run the Blazor app using the Chrome Extension requirement:
chrome --remote-debugging-port=9222 --user-data-dir="C:\Users.....\AppData\Local\Temp\blazor-chrome-debug" https://localhost:7054/
The JS file is still there....appears that this location is holding onto a version of the WASM application?
For anyone that happens across this.
I ran it in Edge and it was fine - no issues. It appears that Chrome is keeping a version on hand and building the solution from that.
I cleared my cache and tried again, and the functions now work as intended.
However, the debugger still showed the old JS File. It seems you have to clear the cache on the debugger Chrome as well - once this was done, the JS file appeared as updated.
Trying to apply bundling to scripts, which worked fine when were located at pages in old way (manually).
This is bundles registration:
Bundle sbundle = new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/menu-correction.js",
"~/Scripts/validation-rules.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.validate*");
bundles.Add(sbundle);
bundles.Add(new ScriptBundle("~/bundles/session").Include(
"~/Scripts/jquery.plugin.js",
"~/Scripts/jquery.countdown.js",
"~/Scripts/session-management.js"));
//others
Then in Layout page call:
#Scripts.Render("~/bundles/jqueryval")
#Scripts.Render("~/bundles/session")
But when minification is become enabled, i got this errors in chrome console:
Uncaught SyntaxError: Unexpected identifier jqueryval:1
Uncaught SyntaxError: Unexpected identifier session:1
Also i can see my scripts in tab page "Sources" of chrome developer tools - they are minificated successfully. Spent enough time trying to fix this. What can be a reason of this mistake?
Thanks in advance.
I provided insufficient information: there is some logic in Application_PostRequestHandlerExecute method which wrotes some tags directly to response stream (is needed for js). I noticed that tags which were written directly in response stream with bundling is being written actually in the end of minificated js file.Thus, syntax is broken and js file doesn't work (Without bundling my approach works fine).
Solution: transferred my logic from Application_PostRequestHandlerExecute to Application_AuthorizeRequest method, where it should was located initially.
UPDATE
Well, tag generating logic was entirely removed from Application_PostRequestHandlerExecute method, cause only now i understand that this is absolutely wrong idea.
My problem is exactly like this one:
https://github.com/mrdoob/three.js/issues/4639
While debugging my js app in WebStorm, every JSON from XMLHttpRequest response is annotated with:
//# sourceURL=http://localhost:63342/JSON_URL_here
This doesn't happen while debugging in Chrome with Jetbrains plugin deactivated, so I guess it's a fair bet that WebStorm is performing the annotation.
The problem is, the JSON file can't be parsed, throwing the following error:
Uncaught SyntaxError: Unexpected token /
Is it possible to solve this issue, other than changing the THREE source code and manually removing the problematic line?
sourceURL appended to any JS file loaded via XHR (jquery load script for example). Otherwise it is impossible to set breakpoint.
You should not use ".js" file extension for JSON files, please use ".json" instead. Is it possible in your case?
I have to implement an existing frameset with JavaScript/jQuery. I´ve embedded the developer version jQuery JavaScript Library v1.9.0.
Every time the right-frame loaded a new HTML-file a function will check the content of this new loaded document. This process will fail sometimes, it´s not possible to understand when (and why) because it occurs randomly.
This is the line which will try to access the frames content:
var Jrightframe = $(iframe.find('frameset#myID frameset frame[name="right"]').get(0).contentWindow.document);
Sometimes, as I said it above, the message will be:
SCRIPT70: permission denied jquery.js, line 3882 character 2
I think it´s a same origin policy problem because I tried this locally (C: partition). But what is the problem to load a file from the partition if the js-script runs on the same partition?
Can somebody please help me to find out what´s going on here?
I searched a long time and found multiple problems like my problem. Ok here is what solved the problem:
Update the jquery core to v1.11.0. It seems only to appear in older versions.
I am trying to run a Javascript file locally, which is supposed to create a CSS image sprite using ImageMagick. It's part of the OpenID selector JS component: http://code.google.com/p/openid-selector/
The generate-sprite.js (http://code.google.com/p/openid-selector/source/browse/trunk/generate-sprite.js?r=140) file is supposed to create the image sprite automatically. However, whenever I run it in IE (the local version of the file, of course), I get the error SCRIPT5009: 'WScript' is undefined on line 19, character 1.
I have of course installed ImageMagick and updated the location in the js file. IE9 is letting the ActiveX execute.
Since I'm not familiar with WScript, I am completely lost. Googling didn't help, since this seems to be a very generic error.
Can somebody help diagnose this error please?
When you say you're "running" the JavaScript file locally, are you using Windows? If so, and double-clicking or typing the filename from the command line doesn't work, try:
wscript generate-sprite.js
...which explicitly invokes wscript.exe.
If you're not using Windows, you can't use that script — it relies on both Windows and Microsoft's JScript (which the wscript.exe program invokes).