How to add a javascript file in GWT host HTML? - gwt

I am trying to add a .js file https://code.google.com/p/geoxml3/#Basic_Usage to my GWT project.
I have made the entry in my host HTML:
I pasted the .js file in /src/main/resources/ and added it to my build path.
I am getting Error:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/src/main/resources/geoxml3.js
I found a very complicated solution here: https://stackoverflow.com/a/1660342/768894
Can someone please help me do it in some simple steps.
Thanks

Copy this file to your /war folder. Then you can simply add this to your host page:
<script type="text/javascript" src="geoxml3.js"></script>

Related

The origin server did not find a current representation for the target resource or is not ... error when running jsp page

I am trying to run this code in my Eclipse JSP dynamic web page. But on running it in the Tomcat Server Version 9.0, I am getting an error 404 message. Error Message-The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. I was trying to include a header page in my other jsp page in this code.
So far I have tried switching the location of the server via server properties. I have also checked the Use Tomcat installation checkbox in Server Locations. Still, I am getting this error.
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<jsp:forward page="http://localhost:8080/HelloJSP/HeaderPage.jsp" />
</body>
</html>
If the page is under WEB-INF folder, an 404 error message might appear. I had the similar problem.
I put the pages under the WebContent folder instead. In Eclipse, the location of files may look confusing. Sometimes right click the file and look at their properties for paths. Just like below :
As you can see, even though pages look like they are under WEB-INF, they are under WebContent. Then, you won't see 404. And you can put the url to see your page in your browser.
If this doesn't help, then check your Web Project Settings.
Right-click your project, go to Properties, and find Web Project Settings.
Can you see my Context root "/" ? If I want to run my jquery.html page, I just type
localhost:8080/jquery.html
If you change your context root to "test", then you type :
localhost:8080/test/jquery.html
Don't forget to clean your Tomcat after changing your context root. Otherwise, it won't apply changes.
Thank You for your help :)
Actually, this problem was solved once I removed all the server from eclipse and switched it off. Then I readded the sever once again and it started working. Still not able to find the reason this error was caused but it was fixed by using the above method.

Server returns 404 on assets for PWA with vue

I run NPM build on the PWA boilerplate I am using.
Folder structure on server is as follows:
my-project ->
static,
index.html,
service-worker
I have then hosted on server and the Manifest and assets are returning a 404.
The project is currently here.
https://evilernie44.github.io/my-project/
Any help is much appreciated.
Changing routes on the manifest and two different servers
I want to get a boiler-plate hosted as a starting point for my PWA
Your script tags point to the wrong path.
Take this tag for example:
<script type=text/javascript src=/static/js/app.98f21a65b373eaa50022.js></script>
The browser resolves it to https://evilernie44.github.io/static/js/app.98f21a65b373eaa50022.js, which does not exist.
The correct path should be ./static/js/app.98f21a65b373eaa50022.js. The extra dot instructs the browser to build the full url relative to the current path.
Alternatively, you can specify an absolute path, such as /my-project/static/js/app.98f21a65b373eaa50022.js which points to the correct location.
In conclusion, any of the following 2 script tags would work:
<script type=text/javascript src=./static/js/app.98f21a65b373eaa50022.js></script>
<script type=text/javascript src=/my-project/static/js/app.98f21a65b373eaa50022.js></script>
By default Vue CLI assumes you are running the application as root, so it will try to load the files from '/'.
When deploying to production, or in a subfolder, you need to set the publicPath in vue.config.js
https://cli.vuejs.org/config/#publicpath

how to use ionic script in angular project

I need to know how to implement the below script in my angular index.html file
<script src='node_modules/#ionic/core/dist/ionic.js'></script>
It is throwing as above URL is not found even though I have installed #ionic/core. Can someone help me with this
i tried to include that script in angular index.html file but it not working
Thanks in advance
Regular
Pinterest

javascript library not loaded in ionic

Im including the google cast external javascript library. When I run with ionic serve it works good, but when I run the app in the phone, the library is not loaded. Debugging can see that :
https://cdn-enterprise.discourse.org/ionicframework/uploads/default/original/3X/a/d/ad4c985f45c1c538bdfbfbb02d10141b6929e1d5.png
The "http" is replaced by "file"!
I tried to include the libraries with that code:
script src="//www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1">
and with type="text/javascript" added; but all codes replaces http by file, and the library is not loaded.
Any suggestions?
When you run the app do not add cdn files starting with "//:", add them like "http://".
If its possible download those files and keep them in directory, after that give directory path to file.
e.g. <script type="text/javascript" src="assets/js/library.js">

cordova 1.7.0 set info error

I am using cordova 1.7.0. My app is running fine in simulator but a message comes like
Error: executing module function 'setInfo' in module 'cordova/plugin/ios/device'. Have you included the iOS version of the cordova-1.7.0.js file?
I have included
<script type="text/javascript" charset="utf8" src="[location of cordova.ios(for ios)]"></script>
in index.html but did not work.Plz help.
there must be something wrong with the path to the js.
The index.html file is read?
Is your www folder maybe a group instead of a reference folder?
Go step by step
This generally happens when the cordova file is not properly available when the page is loaded. You can check that it is referencing properly by opening the index.html (or your start page) in the Chrome and check in Inspect Element that all the resources are loaded and there are no errors.
to solve this problem, just follow steps in picture