Disable google search input focus - javascript

I'm trying to develop chrome extension to save users favourite urls, so user will click in a button and a popup will appear infront of the website he is visiting allowing him to save his url.
The point is when this popup is been shown while user vistiing google.com, user can't write anything in the popup because google's input is automatically in focus so what should I do to disable this behavior?
Note: This is only happening with google.com
Here is example of my code which is inserted in a shadow dom in any page:
<div id="popup">
<label for="add">Add custom bookmark</label>
<input type="text" name="add" value="" id="add" autofocus="" placeholder="Please enter an URL...(www.example.com)">
Submit
Close
</div>

You can disable the "instant research" feature by clicking on "parameters" onthe bottom of google.com page and then "Research parameter".

Related

Cannot input text after closing a confirm dialog by Esc key

After closing a confirm dialog on a page by Esc key, I cannot input any text into any text field on the page. How can I fix it?
This small html should be able to reproduce the problem easily.
<html>
<head></head>
<body>
<input type="text">
<script>
window.confirm('hogehoge')
</script>
</body>
</html>
Repro Steps:
Open this html to open a confirm dialog above the page.
Hit Esc key on keyboard to close the dialog.
Click on the text-input field on the page to try input something.
Result:
Caret doesn't show up, and cannot input anything.
Expected:
Can input text into the text-input field.
Notes:
This repros on Chrome and Edge(chromium).
Not repro on FireFox.
OS: Windows10
Once the focus goes out of the window, this problem disappears.
It seems like it's a security feature, not a bug:
https://www.zdnet.com/article/google-changes-how-the-escape-key-is-handled-in-chrome-to-fight-popup-ads/
From the article
"Since users never intend to interact with the page through the ESC
key, it should not trigger user activation," Google said.
By "user activation" they exclude things like mouse hover or swiping fingers on the screen.

Browser Back button should work same as Back button in my form

I'm working on a .net core web application which has multiple screens, every screen has 2 submit buttons(1 is the Back button and the other is next button) like below.
<input name="back" class="btn btn-outline-secondary mr-2" type="submit" value="Back" formnovalidate formaction="BackToIncidentInfo?tabId=#Model.TabId">
<input name="submit" class="btn btn-primary" type="submit" value="Submit">
The above Back button will act as:
When the user enters some info and click on Back button all the entered info will be saved and user will be redirected back to the previous page.
My requirement here is:
The Browser Back button should act same as Back button in the page.
Mean, when the user clicks on Form Back button Since I am using beginform and the back button type="submit" I am able to get the formfields and based on that I am saving that info.
I am not sure how to achieve this when user clicks on Browser back button.
Please help me out....
Till now I tried using window.onpopstate(), but the issue here is, it is triggering when the page loads, when user clicks on browser back and when we click browser forward...
I want to catch the exact event only when the user clicks Browser Back button...
My intention of solving this issue is:
inside the browser back event I would like to find a back button and make a click function which would achieve my task.. as below:
$('input[name="back"]').click();
So my problem here is only to detect the Browser back button event.

Force soft keyboard to show on focused input in HTML

Currently I'm creating a smart TV app for several brands.
A local equipment shop is willing to let me test the app on their televisions.
All bugs I found aren't that hard to fix, except for one on the Panasonic devices.
The app is launched through the Panasonic IPTV Apps Developers (HTML5) App SDK.
I have a login screen with several input-fields, yet when one is focused the keyboard won't show.
Because of this I can not enter any information and I'm unable to leave or change my focus in the form.
The first input-field has an autofocus.
I removed the autofocus thinking it had something to do with a focus event not registering or something similar.
But after a manual interaction with the input-field, the field is focussed but there is no keyboard that shows up.
Example of my HTML input-field:
<!-- Input username -->
<div class="row">
<div class="col-xs-11 col-sm-8 col-sm-offset-2">
<input type="text" class="form-control" name="username" id="username" placeholder="Gebruikersnaam" tabindex="1" autofocus>
</div><!-- .col -->
</div><!-- .row -->
Example of my Javascript to autofocus the input-field (after a successful login, I navigate a ul (my menu) with the arrow keys of the TV remote, hence the tab-index and forced autofocus.)
$(window).on("load", function() {
$("[autofocus]").focus();
});
Does anyone here know of another solution I can try that may resolve my problem?
You can try this-
In javascript the prompt() opens the soft keyboard.
You can try opening the keyboard on focus event of the input field and to make it auto-focused you can do this.
$(textFiled).trigger("focus");
Also, wait for the DOM to load completely. Hopes this works for your device.

On page load need to set cursor on particular field and auto keyboard open without touch on textfield

How can I open a keyboard prompt without touch on textfield when page loads? I also need to set the cursor on to that field so that keyboard will auto open to type easily.
My Code is:
$("#email").focus();
$('#email').trigger('click');
This will works only in firefox browser not in chrome and others. Also in iphone cursor is not setting on that field.
Please note we have autofocus attribute in HTML5 which does this without any javascript code.
For example:
<input type="text" name="fname" autofocus/>
You can refer to: autofocus example

ipad refresh the tab when clicked submit button

actually m using desktop and ipad..in desktop browser when i click on submit button the page in ipad browser should get refreshed...
suppose in desktop browser i have created a file test1.php
<input type="submit" value= "submit"/>
when i click on submit button the page in ipad should get refreshed that is refresh.php
i have tried the following code
link
this works fine in desktop browser but the same in ipad is not getting refreshed
If you are using an submit button just to refresh a page, you could use this:
<form target='test1.php'>
<input type='text' name='text1'>
<input type='button' value='submit'>
</form>
This will refresh the page, going to, lets say test1.php?text1=[whatever your text may be]
You can then use php to retrieve the value as $_GET['text1']

Categories