Android keyboard remains after sending an email Phonegap - javascript

Built a Phonegap app, and emails in this app are handled using whatever email program the user chooses after clicking the email button. The email button is just a standard HTML <a href="mailto:address"> link.
The problem is, after the user hits send on the email, when they return to the app, the Android keyboard is still there, floating. This occurs regardless of what email program is being used, but only on Android.
I have already tried doing .focus() and .blur() as suggested in other solutions, and even added a hidden text input on the page to target with the focus/ blur action because there are no input elements on the page otherwise.
Do any of you know any other techniques to make the keyboard go away after sending an email, and/or what could cause the keyboard to remain on the screen?
Thank you all in advance.

Related

JavaScript - Event Listener for Alerts and Confirm boxes?

This may be basic, but it's something I'm not able to find the answer to.
I need to write an event listener, which listens for alerts / confirm boxes displayed on the page, and this is what they're expected to do
When there is an alert
Detect that there is an alert on the page.
Capture the alert message
Detect when the user is pressing the OK button (basically an event handler for the alert OK click)
When there is a confirm box
Detect that there's a confirm box
Capture the message
Detect what button the user is clicking. Is he/she accepting the alert, or is he/she dismissing the alert.
I need this for a side project I'm working on, which simply collects some stats from a specific web app and sends back some data for analytics. There are a lot of Confirm boxes on the page, and I would like to record the decisions taken by users.
This could be thought of as a browser extension for Firefox, Chrome and/or IE, which runs in the background and listens to user interactions and report them elsewhere.
I have gone through a post: Click Here, but it doesn't seem to answer my question.
Please help
Thanks,
Sriram

Search input field is blocking on Android (website)

Minor bug I'm trying to fix on Android devices accessing a site.
Flow goes like this:
User inputs text, list returns answers.
User clicks li element, is scrolled to the next page (ng Anchorscroll).
User is then at the top of next page, and can enter next input.
This is fine on iOS and web, but the keyboard is blocking on Android.
I hope this doesn't violate SO terms, but here is a video of the problem with my web app (I won't upload the code).
https://youtu.be/YwXRV_APMOQ
I have tried using conditions such as ‚ "if Androiddocument.activeElement.scrollIntoViewIfNeeded();
On resize $(input).focus();, and even onclick="window.location.href="#destination"
But none are working.
Looking for some sort of work around or help, thanks! :)
Found a work around. On click, focus on the next input. This pulls the input into the screen on Android, which is the behaviour needed.
(I've used Angular method, but can you any language)
How to set focus on input field?

How is this script working and why can't a user select the message box in developers tool to remove it

Go to https://app.sequoiahack.com/ in chrome browser. Don't put you email id and just click "Get started". It will prompt you to fill out email field,don't do it just close the tab. Now the message box is still there (stucked). I tried to delete it using chrome developers tools but can't select it to remove it from html code. I am interested in knowing how can a developer create such a box and whats the cleaning activity/code required to remove it which developer has forgotten to add in the application/web page code. Please see attached screenshot.
Link for the screenshot --> http://i.stack.imgur.com/BCake.png
That's just a standard input element with the "required" attribute. Chrome does some validation when you try to submit the form, and one thing it does is show that prompt if the input element has the "required" attribute.
You could remove that prompt, by right clicking input field, choosing "Inspect Element" and then removing the "required" attribute. If you remove that attribute the form should submit without that prompt appearing (but server-side validation should catch it and you'll get some other kind of prompt for an email address, a prompt that a web developer actually has control over).
I can't reproduce it persisting onto other tabs, but it could just be a bug in your version of Chrome. It is not something the web developer of that website did, and it is not something that is possible for a web developer to control.

What Javascript event gets fired when iOS Safari gets called from another app

I'm working on a mobile website / iPhone app combination. Upon entering the mobile website, I prompt the user to 'go to the app', 'download the app', or 'use mobile website'.
From various entry points to the mobile website, I'm mostly worried about verification emails and text messages, so the user will check email, follow the verification link, enter Safari, get prompted to 'go to the app' and the verification link is sent to the app for it to handle.
Now in the same session, if the user gets another email regarding the app, the user will check email again, follow a different verification link to Safari, and I want the 'go to the app' to work the same with the new link.
Some quirks are that upon entering the mobile website, the verification link is stored and the URL is switched to example.com/home. The iPhone overlay is completely separate from the rest of the site and doesn't have access to the site's storage of the verification link so the event needs to fire as soon as the site loads. This works when first loading the page, but upon re-entering the second time, I need to listen to event that triggers as soon as iOS Safari re-enters. I've tried listening to "pageshow" but by that time, the URL is already example.com/home.
I doubt the solution here is Javascript. To load any Javascript code, the page must already be downloading and <html><head> already downloaded (at least). I believe the only way to get what you want would be to do it in the backend.

Submit ajax form on keyboard close without a submit button on the iphone?

I'm having trouble with AJAX form submitting on the iphone. I have a search field at the top with no submit button. My plan is to submit the form when the user hits "Go" or "Search" on the iphone keyboard. Anybody got any ideas?
Edit: I have the ajax working but I cant seem to get the keyboard to close after I press search.
Here is the code:
<form id="searchForm" method="post" onsubmit="event.preventDefault(); showSearch(search.value);">
<input type="text" name="search" id="searchField">
</form>
Thanks! I got it. Who knew it could be so simple. I just added search.blur(); to the onsubmit.
To remove the keyboard, all you need to do is remove focus on that particular field. You can do this with JavaScript.
Years ago I was trying to use a barcode scanner built into one of those retail inventory management hand-helds with the built-in web browser. It was for a warehouse management system and I wanted to make it web-based. There was a third-party browser that would run on the device.
So I have an input box that the barcode scanner would "type" into (it behaved like a keyboard wedge). The problem I had is there was no way for the barcode scanner to press RETURN to initiate the search, which is similar to your problem. The device too had a virtual keyboard, so people could open it and then press return, but that just ruined the flexibility of the aim-and-shoot the barcode scanner offered.
The solution I came up with was to run a timer to see if the contents of the input box changed. If nothing changed after a certain period, I assumed the input was done, and I forced a submit.
This may work for you too.

Categories

Resources