I am currently working on a project in Laravel for which we need to use ArcGIS. The ArcGIS component works as expected when it is loaded from js.arcgis.com, though it is brutally slow (this is likely because the processes we're trying to run are pretty intensive).
I would like to switch to using a local version of ArcGIS instead of loading from the net, but every attempt to do this fails.
I am using Laravel 5.3 and ArcGIS 3.20.
Code that works:
<script type="text/javascript" src='https://js.arcgis.com/3.20compact/'></script>
Code that doesn't work:
<script type="text/javascript" src="{!! asset('js/arcgis_js_api/library/3.20/3.20compact/') !!}"></script>
The page is a .blade.php file, and I have checked that the asset() section gets the proper (or at least expected) filepath.
Related
I have an Angular 7 CLI app which is served by ASP.NET MVC.
In Index.cshtml file I have these lines:
<script type="text/javascript" src="~/app/runtime.js"></script>
<script type="text/javascript" src="~/app/polyfills.js"></script>
<script type="text/javascript" src="~/app/scripts.js"></script>
<script type="text/javascript" src="~/app/vendor.js"></script>
<script type="text/javascript" src="~/app/main.js"></script>
Everything works fine.
However sometimes during development these files are not generated due to compilation errors etc.
I'm wondering is there a way to write a custom manual loader that will try to fetch these files and if any of these are not found will pop up a nice message to the developer.
Basically a really simple pre-loader to the application.
Any input is greatly appreciated.
In my case, what I do when it comes to altering the index.html is having a controller, which I call SpaController with an Index (default) action. Then, I load the index.html file (which is really small) and patch it with all the changes I want to apply. After being patched and downloaded on the browser, the rest of the communication is done through API REST, so it's just a small patch.
In your case, I would use that action of that controller I mentioned above and check if all the tag scripts are included. If not, you have flexibility to alter index.html and do what you want, like showing an error, or even stop the application.
I am new for node-red and node also.
I have JS library which was used for jQuery project within GUI project.
Now I want to build server side application using node-red. So for example I will have API like Login/Logout which will be called as HTTP methods.
So I understand that I need to use HTTP In node to listen for POST.
The questions:
How to include my existing JS files as I did it in html:
<script type="text/javascript" src="Includes/jQuery/jquery-2.0.3.js">/script>
<script type="text/javascript" src="Includes/jQuery/jquery.xml2json.js"></script>
<script type="text/javascript" src="Includes/jQuery/json2.js"></script>
<script type="text/javascript" src="Includes/jQuery/json2xml.js"> </script>
<script type="text/javascript" src="helpers.js"></script>
<script type="text/javascript" src="Config.js"></script>
How to call function which are in above js libraries and create global object which will be available from Login Method till Logout method?
for example in HTML, I did using global variables like below:
<script type="text/javascript">
var agent_ = null;
agent_ = new Agent(new AgentEventsHandler() new Logger());
1) To make static files available to Node-RED web pages, you can simply configure a static folder.
If you look in your settings.js file (normally found in ~/.node-red), you will see a commented out property called httpStatic, set this to a suitable folder, e.g.:
httpStatic: path.join('', 'public'),
which would use ~/.node-red/public on a standard installation.
Your URL's would all be in the form: /images/myimage.png etc.
2) To call a function in one of the libraries, you need to create a suitable page. Assuming you are using http-in/out, you would use the template node to create your page. Slightly trickier if you want to use the Dashboard. But not by much, in that case, you will use the Dashboard Template node.
If you want to build more complex front-end apps, you might also want to look at node-red-contrib-uibuilder. This does the heavy lifting of creating folders and adding web resources along with managing the in/out messages between the back-end and the front-end.
I built a python app on google app engine that pulls pictures from the flickr API and allows users to do cool stuff with the pictures, like drag and drop.
I have three JS files in the body:
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="js/init.js"></script>
My jQuery code is working fine but only when I write it in either of the jQuery documents. If I place the code in the init.js, the code simply doesn't work, which I find rather weird. I put the code in the jquery files because I wrote console logs on the three script files and only the init.js didn't print to the console. I am linking the files correctly and referring to the right folder and right file. The folder JS was also added to the app.yaml:
- url: /js
static_dir: js
I can just leave the code in the jQuery file but this is not what I am supposed to do. I want to fix it.Is there a specific way to use the JS file on google app engine?
Use absolute paths instead of relative when loading your JS files (add the leading slash /):
<script src="/js/jquery-1.11.0.min.js"></script>
<script src="/js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="/js/init.js"></script>
I fixed it. The problem was that I named the file init.js. For some reason Firefox doesn't like that name (at least mine didn't) and didn't load the file. Chrome loaded the file without any problems. When I changed the file name to main.js, it started working in Firefix as well. I only tried this when I had exhausted all other possible options though. Such a weird behavior of Firefox.
I´m having a headache last two days with Google App Engine and JQuery.
I try to implement the jQuery in the html file and I created de handler in app.yaml, but still does not work. This worked with my css and images, but I´m stuck with the JavaScript.
I also tried to do the same page without Google App Engine AND WORKED!! Why the same code does not work when I display it in my localserver ????
Here goes my app.yaml handler:
- url: /js
static_dir: static_files/js
My call in the html:
<script type="text/javascript" src="/static_files/js/jquery.js"</script>
<script type="text/javascript" src="/static_files/js/script.js"></script>
and the jquery itself:
$(document).ready(function() {
$("#ingles").fadeOut(1000);
});
I know that the javascript code works fine, and I suppose the html call is correct. Maybe the mistake is in the app.yaml? Many thanks!
You have declared your static URL to be /js but in your HTML you are requesting /static_files/js. You should use just /js there too.
The way to start debugging issues like this is by trying to go to the location mentioned in the link, and seeing if that works.
I have website A: http://dl.dropbox.com/u/3264697/calc/v2/index.html
It is working as intended, 100%.
I have website B: http://pe2kasb.net63.net/
It is not working as intended. Website B is a file for file mirror of A.
I assume then, this is something wrong with the host. Looking at the Javascript console, the error appears to be related to the host:
screenshot here http://img825.imageshack.us/img825/4782/unlednwe.png
Need I contact them, or is there something I can do...? I'm new to JQuery, and I believe that's what is the root of the issue but... i'm not sure.
You are trying to load jQuery from ../v2/media/js/jquery.js but there is no such file in the second website.
I recommend that instead of hosting JQuery yourself, you use a hosted version:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript">
</script>
This post explains the reasons.
You have invalid jQuery path at http://pe2kasb.net63.net/
Replace
<script type="text/javascript" src="../v2/media/js/jquery.js"></script>
with
<script type="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
Also you have dataTable.js missing.
You are loading JQuery from ../v2/media/js/jquery.js which does not seem to exist...
To solve the issue and improve the speed of the website
do not store JQuery on the server, rather load it from a 3rd party (Google works well)
use JQuery minified version
To load JQuery from Google you can just use:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1");
</script>
More information here
EDIT: note that the above automatically loads the minified version of JQuery. If, for whatever reason (?) you wanted to load the uncompressed version you could use
google.load("jquery", "1", {uncompressed:true});
Look what http://pe2kasb.net63.net/v2/media/js/jquery.js refers to.
The file does not exist.
Upload it or include it from another location.
Make sure that jQuery is correctly linked, currently jQuery is supposed to be at "../v2/media/js/jquery.js" on "http://pe2kasb.net63.net/", which means go back one folder then enter "/v2/media/js/jquery.js".