Closing browser without user interaction in Xamarin Forms - xamarin

I have a scenario where I need to open a browser to remove user cookies for logging out. So the process is:
Open browser (Chrome CustomTab or SFSafariView depending on OS) and point it towards my URL to delete cookies.
Send the user back to the mobile app login screen.
Where I'm having an issue is step 2. How do I go about closing/minimizing the browser without requiring user interaction? The only thing I have found so far is to run System.Diagnostics.Process.GetCurrentProcess().Kill(); which closes the entire app, but I have seen comments online that doing this might cause the app to get rejected by Google and/or Apple.
Any ideas on how I can solve this?

You can put SFSafariViewController inside the navigation controller and then you can dismiss the navigation controller. That's for iOS assuming that you already know when to call this code, just don't know how. For Android... no idea for now, probably you should ask it as a separate question not too many people are experts both for Android and iOS...

Related

Cannot start web-simulator on google actions for API.AI project

I am working on Google Cloud Platform to develop a project in API.AI, I have an integration (in API.AI) with Google Actions (for Google Home or Google Assistant), they provide me to see my progress as real time in web-simulator, that you can find here:
https://developers.google.com/actions/tools/web-simulator
I am trying to START the web-simulator clicking on START button, then I get a window pop-up but after open, it closes, I try and try again but I obtain the same result, I cannot open the web-simulator. I have allowed the popup windows in my browser.
Of course I have completed all steps to start web-simulator...
I don't know what is happening. Someone can help me? Thank you, have a good day.
First, are you using a compatible browser? Try it in Chrome if you're
not already using it, as Chrome is a Google product, and so is the
web simulator.
Next, are you using any Ad-Blockers or
Script-Blockers like NoScript? If so, try disabling them, as they
could interfere with the operation of the tool.
If it still doesn't work, try going to an Incognito Windows by pressing the
three dots button and opening a New Incognito Window. Go to the page, and log
in. This will ensure that no cookies are interfering.
At this point, if you're still having issues, try a different browser.
(Either Firefox or Opera)

OSX link preview on one-time link

As part of a password reset process, it's not uncommon to send out a one-time link that will expire once clicked, or similarly activation links. We're seeing an issue where a user accidentally Force Touches a preview and expires the reset link in OSX Mail, thereby being unable to click the link to complete the form in a browser. Is there any way to prevent this preview behaviour to stop this happening? I found this similar question asked on the Apple forums but with no answer.
https://discussions.apple.com/thread/7150121
Thanks
Jason
As far as I know, this is impossible. This feature is baked into the very core of OS X and unless there is an option in Settings.app there is now way to disable it.
Also there is no specific header or user agent set so you could determine on server-side.
Unfortunately the answer seems to be no.
EDIT
In the comments we came up with a JavaScript workaround. Since the force-click preview does not execute JavaScript, you could do the actual resetting process using AJAX or view a JavaScript redirection on a different page.

Can an OS X app interact with the web browser?

I want to make a Mac app that is able to know things about the page the user is currently viewing.
Is this possible? I have 1Password installed, and it seems to be able to fill in forms, so it must be possible. Or am I mistaken in what is happening?
If that is what is happening, how does the Mac app find the current open window, find the forms on that page, and then enter the text into them?
I think 1password has an actual browser plugin, which a user would explicitly give permission to view their visited websites. I would imagine that's how it would be able to prefill forms automatically. If you write a browser plugin, you can do this too, but again by requesting permission from the user first.

Communicating with users on other web pages

This question is part user experience, part engineering.
I am trying to find a nice, clean way to have a user communicate with my web page while they are on another web page. I have web services that will accept HTTP POST/GET, so AJAX and other asynchronous niceties are welcome - don't worry about the details of their communication, they can easily be modified to fit a solution.
The problem I'm running into lies within the user interaction. Ex., say the user is viewing a web page and they want to send my system the web site's URL. I would like it if they could do it while still looking at that page, and without too many "crazy clicks" - currently they have to go back over to my page and enter the information (as you can imagine this has tested horribly).
I have ruled out browser tool bars (easy to do in FF, but a lot of my users use IE) and local applications (they won't want to install Java or Adobe Air apps).
Have you ever solved a problem like this before, or do you have an idea of how I could solve it? Should I be looking at separate solutions for FF and IE (ex., a tool bar for FF and something else for IE)? Don't worry about Safari and Chrome, though a solution that supports them too would be nifty.
Thanks.
p.s. The user would have an account on my system already.
Have you thought about something like the Digg Bar?
Users can access it through a bookmarklet, or you can do a url prefix like http://yoursite.com/<other_site_url>. When users click links, the bar stays active.
What if you wrote a system tray application. Something similar to Pixel Ruler
This could sit in their tray, and it would know you're website. That would eliminate browser toolbars, and could conceivably work on several browsers. You could probably even set it up as an install if they visit your website.
Then you could expose a webservice on your site that this control would pass back info to (like the user's name, current website, etc)
I don't know about the details of your application, but the only solution I can imagine is that you have a page split into two frames, with your toolbar at the top. stumbleupon.com does this, but it makes sense because they're providing the web content.
Simply, your users would have to visit your site before they could do their own browsing. Is that reasonable for your project? That sounds like it could be a user experience disaster of its own. Also, if most of your users are using IE, I'm going to assume that they're not the most web savvy users out there.

For a web application, how to close all the related browser windows when session is timed out / user signs out?

Suppose user has opened my web application in many different browser windows. After sometime he is timed out / sign out from the application.
I want to close all the related browser windows. How can we handle this?
(I think GMAIL does that)
If you maintain references to any child windows, you can use window.close() in combination with setTimeout().
As a note, you should probably exercise caution when closing users' windows, as it can potentially cause a bad user experience. Imagine that I've opened up my bank's website to look at the transactions for an account so that I can clear/reconcile them. But in the middle I run off to grab some lunch or something. When I come back, I find that all of my windows have been closed and I have to relogin, even though I didn't need to 'cause I was just looking at a relatively static list of data. Or even worse, if the window-closing isn't coded correctly, I might find that my browser has been closed entirely, which is definitely a bad experience.
Don't. As far as the typical user is concerned, your web site does not have the right to close the user's windows and they will HATE your site if you try. If you think that your web site's proper operation depends on being able to close the user's browser, then you are doing it wrong.
Furthermore, there is no way that you can count on the success of your attempt to close user windows or perform similar such actions. So spend your time making your web site work properly regardless of what the user does in the browser. Besides, it is easier that way.
Write a scriplet that when the focus is brought to the window (for your application) it checks to see if the session is still valid. If it is not, then send a command to close the window.

Resources