javascript library not loaded in ionic - ionic-framework

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">

Related

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

Play framework bootstrap images not available in production work in dev

I added Bootstrap to my Play 2.1 application. After adding the following routes, it works well in development:
GET /img/glyphicons-halflings.png controllers.Assets.at(path="/public", file="/images/bootstrap/glyphicons-halflings.png")
GET /img/glyphicons-halflings-white.png controllers.Assets.at(path="/public", file="/images/bootstrap/glyphicons-halflings-white.png")
This works fine in develop mode, but when I package the application using "dist" in play console, the glyphicons aren't available. What could possibly be causing that?
I also ran a jar xf on my the application's snapshot jar and can verify the images are there and are in the same layout as they are when I run play run locally.
All you need to use Bootstrap is unzip it into public/bootstrap/ folder and then just include it via Bootstrap's CSS in your view (you don't need to create separate routes(s) for glyphicons etc) while it's ready to use package, just don't move its pieces to folders proposed by Play docs and keep them in original structure:
<link rel="stylesheet" type="text/css" href='#routes.Assets.at("bootstrap/css/bootstrap.css")'>

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

PhoneGap + WP7: how to use a plugin

How do I integrate a plugin with PhoneGap on Windows Phone 7?
I've found tutorials for iOS, Android and BlackBerry, but nothing about WP7.
I've put the .cs file in the Plugins folder, but I'm not sure it is enough.
To integrate a wp7 plugin with phonegap these are the general steps :
Include the plugin definition and js implementation javascrtip file in your html page head section
[script type="text/javascript" charset="utf-8" src="myPlugin.js"][/script]
in your code you need to call it like:
navigator.plugins.myPluginName.myPluginFunction(parameters);
you may need to make few additions in your html as per plugin required.
Also check for entry for myplugin in WMAppManifest.xml
I have used myPlugin as an reference so please replace the name with your actual plugin name.
Hope this help you
~K
The problem was in the .js file.
PhoneGap is now called Cordova, so the js files of old plugins have to be updated with the new class name.