Open smkamranqadri opened 6 years ago
I'n having the same problem. The _cordovaNative is present but not cordova. How can it be injected?
my mjs_api_access:
"mjs_api_access": [
{
"match": "*",
"access": "cordova",
"platform": "ios,windows,android"
}
],
"mjs_cordova": {
"plugin_mode": "client"
},
Don't know, my problem still exist, maintainer please help us.
hi folks, this is for android correct? have you reviewed the old docs:
https://github.com/pwa-builder/PWABuilder-CLI/wiki/Using-Cordova-Plugins-in-Hosted-Web-Apps you may need to set the cordova.js to be injected automatically, we had it set so that you could add it to your website, or have the tool auto inject it at page load.
Yes, Android. Aren't the mjs_api_access and mjs_cordova directives enough to get cordova.js automatically injected at page load?
so make sure you are have clien mode set: https://github.com/pwa-builder/PWABuilder-CLI/wiki/Using-Cordova-Plugins-in-Hosted-Web-Apps { ... "mjs_cordova": { "plugin_mode": "client" } }
Yes, it is set. using plugin_mode.
Have you tried with a different value for the match
attribute in the mjs_api_access
rule instead of '*'
?
I'm not sure that using a wildcard for the entire URL is supported. Try a more complete URL like https://github.com/*
to see if that works.
Yes, first I've tried the URL like https://github.com/ . I've changed to after that.
Did you update cordova ios? It seems like newer version don't work.
we did update but I don't think it has made it to public builds yet. @nbellocam right? Our update should get iOS working again. We are pushing it through the system this week
@boyofgreen are you still planning on doing the update this week?
I just realized that you updated the IOS version in the meantime. After downloading the project, I added the following lines to the manifest and built the cordova project.
"mjs_extended_scope": [
"*"
],
"mjs_api_access": [
{
"match": "https://domain.com/*",
"platform": "android,ios",
"access": "cordova"
}
]
Then, I ran it on an Iphone using Xcode and couldn't find the cordova.js. Is still supposed to work?
Those settings worked before, as long as I didn't update the cordova-ios-version that came with it.
I have been struggling with the same issue.
After playing with various combinations and following the various Wikis, the only time i've seen cordova.js served from the App's local files itself when the default index.html file is used instead of my webapp's index.html.
To load the default Cordova screen I removed the reference in config.xml which was pointing to my site:
<content src="https://mywebsite.com"/>
The default index.html file references the cordova.js file, which is resolved to file:///android_assets/www/cordova.js
If I add <content src="https://mywebsite.com"/>
back into config.xml so my site's index.html file is used, the same link ` is resolved to https://mywebsite.com/cordova.js. Which doesn't exist..
Is it possible that the "client" plugin_mode in the manifest is being ignored, or perhaps not correctly passed down to the generated android app?
I have this in my manifest.json.
"mjs_cordova":` {
"plugin_mode": "client"
},
"mjs_api_access": [{
"match": "*",
"platform": "android, ios, windows",
"access": "cordova"
}]
Alternatively, could it be the scope is now wrong when running against a remote website? So android_assets/www is not the default location, it will now be https://mywebsite.com
As an experiment I tried setting my website to reference cordova.js as
<script src="file:///android_assets/www/cordova.js"/>
But this gave the following console error in the android debugger:
Not allowed to load local resource: file:///android_assets/www/cordova.js
Serving cordova.js and cordova_plugins.js as recommended here works. Although that is without the "plugin_mode": "server"
being set. Which leads me to believe the setting is just ignored all together.
I would much rather use the client
plugin_mode so I don't need to serve the plugins on my website. Has anyone successfully achieved this?
Thanks
Would love to see some progress here, I have followed the above information (updated my manifest etc) and simply do not get a cordova.js asset within my web app. Seems a bit odd to me that an app generated with PWABuilder doesn't have access to cordova.js by default. @SamLoy did you ever make any progress?
Any news here? This completely destroys the whole point of using pwabuilder.
I am working on an old project built with manifold for iOS, now working to build android app.
I have added the platform and also added android in manifest under mjs_api_access but still the cordova file is not injecting.
Help in this regard is much appreciated.