JavaFX redirect to web page - html

Does anyone know a simple way to get, for example, a button action event within a web deployed java fx application to direct the browser to a new web page?
So in my application I want to go to the home page of my website when the user clicks a javafx button.
I think this can be done with javascript & javafx, but i think it is messy......

application.getHostServices().showDocument("http://www.mywebsite.org");
hostServices.showDocument(uri)
Opens the specified URI in a new browser window or tab. The
determination of whether it is a new browser window or a tab in an
existing browser window will be made by the browser preferences. Note
that this will respect the pop-up blocker settings of the default
browser; it will not try to circumvent them.

Related

Why chrome shows alert randomly when try to open custom protocol url with location.href?

i had took a look to another threads about chrome and custom protocol apps, but i couldn't resolve a doubt i've got. In my web app, when you click a button it fire a new tab with an webpage (window.open(url, "_blank")). The new tab is opened with the url (annother web app with https protocol). This url fire a javascript function on load that verifies some things and then generate a custom url, for example myurl://base64code, and put it in an existing iframe in this way windows.frames['myframe'].location.href=theCustomProtocolUrl. i tried in different ways (location.replace, create a new iframe and set the url, etc) and i always have the same problem. If i refresh (ctrl f5) the page it always show the dialog or if i open the link with the developer console opened. But if i click my button and the page is opened in a new tab it doesn't work only if i refresh (ctrl+f5). This works perfectly on IE11, it launch the app directly.
Any ideas why chrome, and edge, works like this?
UPDATE: I have found the reason, is i use the protocolcheck.js (https://gist.github.com/vladimirtsyupko/cfcd332476b16683bb0b) library.
First i tried to open a protocol with the timeoutHack (it use blur event) and then, after failing, it fires the other url (in this case https) and the dialog doensn't appear. I found a bug with blur event on chrome > 85 https://bugs.chromium.org/p/chromium/issues/detail?id=1137801
Thanks in advance

Clicking link with target _blank makes browser close new tab immediatly

Clicking on a link to our webpage using
Link
opens a new tab and closes it immediatly. This happens on all browsers apparently. Deactivating adblock and alike does not change anything.
Using the url without target="_blank" or right click -> open in new Tab however works fine.
The web page is an angular project and does not use any sort of trackers. Furthermore this behavior started only recently, so I assume it's due to some change in the page.
Any hint why this happens or where to start debugging this?
Found it.
I had a line window.close(); due to a workaround for a popup for facebook login, implementing this:
Facebook Login not working in PWA app if app is in stand alone state

How would I open my Chrome app in split screen rather than a new window?

I'm doing a little research on how to develop a Chrome app for a project I have in mind. I would like to open my app in a split screen inside a person's browser tab, so that they can still see the webpage in the browser while interacting with my app. (In the same way that the console and developer tools work.)
Everything I've seen so far indicates that apps can only open a new window, not "split the screen". Is that correct? I haven't seen it explicitly stated.
If splitting the screen is possible - what's the notation/api?
The other option I'm aware of would be to create a DevTools extension (that operates in the Developer Tools split screen window.) I'm not sure that's preferable for this particular app, though
thanks.
Yes, this is correct. Chrome Apps cannot integrate with the browser UI, that's a design choice by Google.
If you need to interact with a browser tab, it must be an extension.
A DevTools panel is not a bad idea, since it frees you from the burden of injecting your own UI into the page. Otherwise, you'll need to modify the page's DOM (perhaps by injecting an iframe with your extension's page).
There is a proposal for a sidebar API, but it's not implemented (or rejected) as of yet.

Using chrome to convert window.open to Chrome always on top panel

I have a web app that is using javascript window.open command, my wish is to make these popups always on top.
Looking on the internet I saw recommendation to add body.onBlur='self.focus'.
This is not good for me because other windows cannot be accessed in this kind of approach.
What I thought is to write an extension that on pop-out will convert the window.open-opened pages to a chrome dialog.
The big question: This is even possible?
In the chrome dialog that I have tested the panels are always on to only if they are positioned in the top right of the window but if I am moving them to a different location the always on to function doesn't work
https://chrome.google.com/webstore/detail/site-on-panel/pcjbpfaogjhnnnhdldamflaelejhbhag?utm_source=chrome-app-launcher-info-dialog
https://chrome.google.com/webstore/detail/picture-in-picture-viewer/efaagmolahogmekmnmkigonhfcdiemnl?utm_source=chrome-app-launcher-info-dialog
If you control the web app, you can replace window.open with a Chrome App. You can send a message from the web app to the chrome app, which can then use the always on top app window option and display it in a webview.

Google Chrome extension installed popup

While installing the Google extensions form chrome web store it shows some popup like "Google Chrome extension is now installed".
I want similarly, while login I need to show the login popup.
Please suggest me on this.
You can create either a browser action or a page action popup. You can change popup html dynamically to make it look completely different depending on the situation but you can't open it programmatically (desktop notifications could be used for alerts).