Sumup terminal payment callback opens in a new tab - browser

I'm using the Sumup payment terminal connected to a tablet, calling location.href='sumupmerchant://pay/1.0?affiliate-key='blabla'&callback=https://www.----' from a javascript in my website. Works great besides that the callback opens in a new tab in the browser. I want the callback to go back to the tab from where the call was made. Is that possible? Otherwise - is there a possibility to close the new tab and refresh the ordinary tab? I'm using the Star Webprnt browser which I think is a Chrome clone.

Related

Chrome Extension Disappears while clicking outside of its resolution

Is there anyway that I can make Chrome Extension's window stick in window even while clicking outside of its resolution?
I'm trying to make it Sticky on the window for one simple google login so that I don't need to go back again to click extension to open it.
By using tabs API you could retrieve windowId of the window you want to focus on. You could do it only if needed e.g. by using query method from that API. You could pass url for example.
If you created a window that you want to be still focused then you have its id already in the hand.
After that, you could use window API update method in order to draw attention or focus. Take a look at updateInfo params - focus and drawAttention.
The same could be done by using tabs API. You could pass tabId and the URL you want to redirect someone.
Now in order to make it work you have a couple of options:
You can use setInterval which would be used to check if the tabId and windowId you want are active and focus the window/tab you want in another case.
Because in the MV3 extensions using setInterval is not recommended you could use alarms. Please take a look at AlarmCreateInfo, when param should help you instead of triggering the alarm periodically.
You could also use event listeners from both windows and tabs API to listen on tab / window focus change. Then you will be able block the change (from user perspective) by methods I described before.
You should play with all approaches and pick on that suits you, because all of them have some drawback. But don't want to make that comment very long.

Load/run/execute Chrome extension in new tab

Is there a way to run/execute a Chrome Extension in a new tab/window by loading the extension's code in that new tab or window?
Right now, the only way I know to get "free hosting" from Google for my Chrome extension, is to use the popup window as my main application window. That works fine, except for the fact that the popup window will close if you click on a different tab. So I think I need a different type of window as my main application window.
My only guess, is that you could set the window.location of the new tab to something like chrome://extensions/<my-extension-id> but that doesn't seem to work.
Can anyone alleviate my confusion? How to create a runtime for a Chrome app that isn't the popup, but isn't a native app, and isn't hosted by some web server other than Google's servers?
One thing I was thinking of was something like this:
https://gist.github.com/danharper/8364399
holy crap that was harder than it needed to be.
So you eventually end up at a url like this:
chrome-extension://<your-extension-id>/dist/index.html
to programmatically load a new tab or window, use this code in your background script:
chrome.tabs.create({url: chrome.extension.getURL('dist/index.html')});
in my case my app page, is located at dist/index.html, whereas my popup page will live at popup.html.
So the popup window looks something like this:
x Load extension in new window
x Load extension in new tab
the user selects one of those, and the background.js script can call the above code to load the page, which will load the html file from your extension codebase that you so desire.

BAck to external browser closed app

My application is opened in an external browser.
there possibility that when a person returns to the application will automatically close?
Thank you,
No. The browsers are all "sandboxes". They can't detect when you return to your application.
The best you can do is in JavaScript, ask your window to close when you think the user is doing working in that tab (but the users can decline to close in some browsers):
function closeWin() {
myWindow.close(); // Closes the new window
}

After clicking Browser back button, BeforePageLoad-Code not run

My problem is that after clicking the Browser back button the code in the BeforePagesLoad-Event not triggered. There is a function to get set an object in a manged bean.
I dry to set the cache control to no-store but that don't work. the-order-of-events-in-xpages
Is there a way to trigger a event after clicking the browser back button?
I am no x-pages expert, but it looks to be a server side technology, meaning that a server call must be made in order for the code to run.
The first thread is a solution for forcing a page reload via cookies, while the second involves javascript/jquery. The second also may touch on some cache control of different browsers.
Force a page refresh when page visited from back button
Is there a cross-browser onload event when clicking the back button?

Browser navigation, back button issue

I want to know how you guys deal with back button issues in your web applications.
I can not forbid users to click back button on their browser, but when they hit it, the page code doesn't run. So writing in page_load() makes no sense.
I have searched online and found this link: Disabling Back button on the browser. It does not work for me. Any idea?
There is no way to disable the back button. You can try to open your page/form in a new window so there would be nothing to navigate back to
Normally, If I have a critical or lengthy form, I tend to maintain a dirty-flag and if the user starts entering something, the dirty-flag gets set and on save or submit it gets reset. You can use unload/beforeunload javascript event to see if the dirty-flag is set and ask for confirmation.

Resources