Stream was closed after creating BrowserComponent - codenameone

From 2 years I was using BrowserComponent to display html code and Browser Navigation Callback to catch url changes.
In the past, all things worked fine but currently, there are some issues that I'm facing.
First one:
isuess during redirect to a url from html page:
The webpage at
http://yallagym.herokuapp.com/payment/callback/accepted could not be loaded because:
net::ERR_CLEARTEXT_NOT_PERMITTED
Second issue:
Unable to load html page and white page appears:
[EDT] 0:0:23,863 - Codename One revisions: 7dd4e7d08b3442d90959477ee52a5ae8c4361b29
[EDT] 0:0:23,864 - Attempting to create browser component
[AWT-EventQueue-0] 0:0:23,868 - Attempting to create browser component
Using:
JCEF Version = 83.4.0.260
CEF Version = 83.4.0
Chromium Version = 83.0.4103.106
initialize on Thread[AWT-EventQueue-0,6,main] with library path C:\Users\fuad-\.codenameone\cef\lib\win64
Added scheme search://
Added scheme client://
Added scheme cn1stream://
DevTools listening on ws://127.0.0.1:56645/devtools/browser/0f082d24-9bc9-4a81-b652-7960d4b4e947
AppHandler.stateHasChanged: NEW
AppHandler.stateHasChanged: INITIALIZING
AppHandler.stateHasChanged: INITIALIZED
url:https://cn1app/streams/1
Stream was closed
for first issue I found this build hint could be help
android.xapplication_attr=android:usesCleartextTraffic="true"
For the secound issue I did not find any solution.

Related

Simulator Freezes With BrowserComponent

I have a BrowserComponent that loads a specific URL.
BrowserComponent browser = new BrowserComponent();
browser.setURL(url);
browser.addBrowserNavigationCallback(url -> {
...
return false;
});
This URL redirects to another, with the new page showing a JS alert dialog.
The Simulator freezes without exception or error while attempting to load the page with a dialog, and the only choice left is closing the Sim.
How do I handle a JS dialog in a BrowserComponent?
It will be great if I can dismiss an alert dialog automagically.
My run log:
JCEF Version = 84.4.1.262
CEF Version = 84.4.1
Chromium Version = 84.0.4147.105
initialize on Thread[AWT-EventQueue-0,6,main] with library path ~\.codenameone\cef\lib\win64
Added scheme search://
Added scheme client://
Added scheme cn1stream://
DevTools listening on ws://127.0.0.1:56113/devtools/browser/8a42a5d0-5ad5-4838-9027-ee9737d73370
AppHandler.stateHasChanged: NEW
AppHandler.stateHasChanged: INITIALIZING
AppHandler.stateHasChanged: INITIALIZED
Stream was closed
[EDT] 0:0:18,233 - Codename One revisions: 7dd4e7d08b3442d90959477ee52a5ae8c4361b29
[EDT] 0:0:18,234 -
[0322/062422.651:INFO:CONSOLE(22)] "Here I am !!!", source: https://cn1app/streams/1 (22)
This issue has been fixed in Git with this commit:
https://github.com/codenameone/CodenameOne/commit/c4afc9d428a959e2f8dcf37594bed8ae81e467a2
It will be included in the next Cn1 update this Friday.

Routing issue with AngularJS project using yeoman setup [duplicate]

This question already has answers here:
AngularJS: How to remove #!/ (bang prefix) from URL?
(6 answers)
Closed 5 years ago.
I have setup a new Angular project using yeoman. Angular version is 1.6.0. Project setup was successful but I have been facing an issue with routing
Task runner - Grunt
When I run the project in local my local page will load with URL
http://localhost:9000/#!/
I was expecting http://localhost:9000/#/
When clicked on About link browser is routed to
http://localhost:9000/#!/%23%2Fabout
Expectation: http://localhost:9000/#/about
When I click home link browser is routed to
http://localhost:9000/#!/%23%2F
Expectation: http://localhost:9000/#/
What might be the issue? I have no such issues in my other system where I'm using AngularJS 1.5.8.
I got resolved with following code.You can write in your app.js file
$locationProvider.hashPrefix('');

ReactJS with react-router Browser History issue

I have a reactjs website, that uses react-router with browserHistory.
Today I found an issue and I have no clue how to solve this.
The problem is, when my website is opened inside an iframe, for example in google translate page. Navigation in my website no longer works everytime a link is clicked it gives me this error:
Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'https://www.mywebsite.com/page' cannot be created in a document with origin 'https://translate.googleusercontent.com' and URL 'https://translate.googleusercontent.com/translate_c?depth=2&hl=fr&prev=sear….com&sl=en&u=https://www.mywebsite.com/&usg=ALkJrhiWY47c812s4y3W0cS1VDZX0xRNqA'.
Does anyone knows how can I 'fix' this?
Btw, I've tested this using the latest version of Chrome, and Firefox (both on Windows)
Thanks
This is a security design. You cannot push history state cross-domain.
Mozilla documents this limitation pretty well here:
https://developer.mozilla.org/en-US/docs/Web/API/History_API

Error URL pdfMake.js with Ionic Cordova App

I have a problem using pdfMake.js library. This library is supposed to generate PDF, client-side only.
It works well with chrome, Firefox...
But when I launch my ionic app on a device (Android in my case), I have the following error :
CordovaWebViewImpl﹕ Blocked (possibly sub-frame) navigation to non-allowed URL: data:application/pdf;base64,JVBERi0xLjMKJf39/f0KNiAwIG9iago8PAovVHlwZSAvRXh0R1.......
I encountered this problem before with AngularJs for example for Blobs...and using the following configuration worked :
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension|blob):/);
BUT not here... :(
Do you have any idea how to allow the data/pdf ?
Thanks !
You have to add permissions to your App inside manifest.xml file

AngularJS set up with Webstorm

I'm getting started with Angularjs and fallen at the first hurdle :-(
i've installed node (windows installer) and the webstorm ide. in webstorm i've installed the angularjs plugin and in the html typing 'ng' prompts all the ng templates in a dropdown, so this look ok.
cutting and pasting in the demo html5 (under the heading 'The Basics' at http://angularjs.org/) and running in webstorm and navigating to the file url (in firefox or chrome) however the angular statement '{{yourName}}' isn't binding at all - it's rendered out as a literal. Anyone know where i'm going wrong ?
The example on the home page was using protocol-less (or protocol-relative) URLs (http://www.paulirish.com/2010/the-protocol-relative-url/). While those are very handy, protocol-relative URLs don't play nicely with the file:// protocol in this case. Simply your browser is trying to retrieve AngularJS library from the local file system. To fix it you need to add protocol:
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
Try prefixing the ng tag with data like data-ng-model.

Resources