Disable mobile Chrome 43's "Touch to Search" feature programmatically - javascript

When I select text in Chrome 43 on my Android device I get the "Touch to Search" popup. We're currently using text selection for a feature on our site and this new Chrome feature interferes with some of our UI.
In the long run, we'll be working out new UI/UX to work side-by-side with this feature, but in the interim, we want to disable it on our web app.
Is there some sort of meta tag or JavaScript we can add to turn this off? Does anyone know if this is currently possible?

This can be manipulated in a number of ways. The user can turn it off in flags as PaulI suggested, and you can control it.
Developer control, right now there are a couple of options but the basic summary is if we think it is an user interactable element then it won't be enabled:
CSS: -webkit-user-select: none;
HTML:
Anything with an aria-role will not have the touch to search enbabled
Anything with a tabindex of -1 or > 0

Possible workaround could be to wrap text in <button> tag. This obviously wouldn't work if talking about big blocks of text, but for other elements like titles, icons and other small stuff this works fine.

As of 2021, it isn't possible to disable touch-to-search (when this is triggered by a long-press for text selection) in chrome mobile. The article that Kinlan is referencing is apparently concerned only with touch-to-search triggered through a tap gesture.
Quoting donnd, from bugs.chromium.org:
Regarding #2 -- developer control: The 2015 article that you mentioned (https://developers.google.com/web/updates/2015/10/tap-to-search) focuses on triggering through the tap gesture. As you correctly point out, it does not address the long-press gesture triggering. Touch to Search responds to both tap and long-press but treats them differently. As I'm sure you know, the long-press gesture activates a whole set of features which can include copy, translation, smart text selection, and Web Search. A site developer can markup their page text as non-selectable in order to disable the long-press gesture entirely, but currently there's no way to disable only the Touch to Search response to long pressing. If you'd like to work with us to add such a feature, let us know and we'll file a separate feature request.

If you want disabled "touch to search" in a menu that has an action open / close (toggle), it is necessary to javascript :
event.preventDefault();

Navigate to about:flags or chrome:flags and look for Enable Contextual Search
Then toggle to Disabled and hit restart at the bottom.

Related

How can I get a VB webbrowser control to click a button that cannot be clicked manually in the control but can in an actual IE window?

I have clicked many buttons without ever hitting a problem like this. I'm using VB 2010. If I click on the control programmatically or manually, the screen flashes like it is just refreshing. However, if I open a separate IE window, I can click the button and it advances to another screen as expected. I have researched this on other sites and have found one suggestion that the control is using a different version than the full version, which is IE 8 in my case. This still doesn't provide a solution. Can anyone please help? Here is the code which clicks the button as well as the html of the button.
WebBrowser1.Document.All("posForm:estimate").InvokeMember("click")
<button onclick="validateForEstimate(this, 'NonITS');" type="button" name="getestiamte"></button>
Maybe try the Microsoft Browser go to your toolbox right click and click choose items then go to COM components and use the filter to find Microsoft browser then check mark it. Add it to your form and done.

Overriding web application keyboard shortcuts

I think this question is going to be rare, hence enjoyable for some. I have two products - Salesforce's Developer Console & Google Chrome.
Google Chrome has built in hotkey - ctrl + page up/down to switch tab.
Unfortunately Salesforce's Developer Console uses the same hotkey to switch between tabs within console.
Now I will contact Salesforce support and maybe 3-6 months later they will fix the problem. I suppose contacting Google for support is ...
I have tried Shortcut Manager extension for Chrome but it does not have the option to disable the mentioned hotkey.
I was thinking wether it would be possible to overwrite the integer value in keyCode in Salesforce's script?
I've read somewhere that browser Extensions do not have such access. Not sure whether that is true, but then perhaps something like Privoxy could work?
Thank you all.
To enable and customize keyboard shortcuts:
From Setup, click Create | Apps.
Click Edit next to a Salesforce console app.
Click Customize keyboard shortcuts.
Click Edit on the top of the page.
Select Enable keyboard shortcuts.
Edit an existing keyboard shortcut or create a new one:
To edit a shortcut, click Edit next to the shortcut, type the combination of key commands to use, and click OK.
To create a shortcut, click +Add Keyboard Shortcut, type the action the shortcut will perform, a Console Event Name, which is a unique identifier, the combination of key commands to use, and click OK. For the new shortcut to work, you must send the Console Event Name to the developer who defined your shortcut’s action so that he or she can add it to the method that will trigger your shortcut.
To deactivate a shortcut, deselect Active next to the shortcut’s name. You can’t delete the default shortcuts provided by Salesforce, but you can edit or deactivate them.
Click Save.
More info here.

Is it possible to inject HTML into a website to force-enable scrolling?

Okay, so this is a bit of an odd question. Facebook is trying to remove the feature that hides your profile from search, but requires you hit an accept button before they can remove it. I like my privacy, so instead I just used ABP to hide the dialog box and give me back access to the page. The problem is that scrolling has been disabled, so while I can interact with the content that's currently visible, I can't scroll down. Is there a way to inject HTML or JS that would force-enable scrolling?
Seems as a job for greasemonkey
https://addons.mozilla.org/sv-se/firefox/addon/greasemonkey/
There are similar plugins for other browsers, Chrome have support for users scripts by default but there is a great addon there as well
https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
Internet Explorer can also offer this by adding Trixie
http://trixie.softpedia.com/
If you don't need it all the time and don't want to go to the effort of making a script you could just edit the html directly using either the developer tools built in to most browsers and inspecting the element.
Just right click what you want to change and select inspect element.
Adam

How can I disable the history swipe action in Google Chrome?

I am creating a browser-based desktop application with a text view. The text view may contain long horizontal lines. In Chrome, doing a left swipe on a track pad will sometimes activate the history.back action and sometimes activate the scroll left action. This is more than a little annoying for our users.
How do I disable the history swipe actions so that swiping will only scroll?
Note that I already supply a custom pushstate event handler. And also that moving forward/backward in history has appropriate meaning in the app, so I can't just disable history.
From what I've seen, there is no officially-sanctioned way to fix this. Toggling swipe gestures is regulated at the system level, not at the browser, so the only way to disable them is to do so manually in the system preferences (turn off "swipe between pages" in System Preferences -> Trackpad -> More Gestures).
However, after searching for a little while, I stumbled upon a hack that uses JQuery's mousewheel.js to override the settings.
This plugin by Pablo Villalba of Teambox was the first implementation I found when searching for a plugin that implements such an override. Hope this helps.
On mac i disabled swipe between pages under System preferences.

How do I focus an HTML text field on an iPhone (causing the keyboard to come up)?

I'm writing an iPhone web app, and I want to automatically focus a text field when the page is loaded, bringing up the keyboard. The usual Javascript:
input.focus();
doesn't seem to be working. Any ideas?
It will only show the keyboard if you fire focus from a click event, so put a button on the page with a onclick that does the focus and it will show the keyboard. Completely useless except for validation (on click of submit validation code focuses on invalid element)
Edit: The following no longer works on iOS - UIWebView did allow autofocus and home screen links used to autofocus but they disabled that many versions ago.
The autofocus (see below) property doesn't work from a url in Mobile Safari but does work if you are:
using a UIWebView
using a home screen link
The fontsize of the input needs to be large enough to avoid the iOS10 zoom on double-tap (now that viewport is always zoomable) and to design the page to be sized so that it fits the screen (otherwise on page loading you get strange timing/race bugs in zoom, or if scrollable the field sometimes doesn't center to the screen properly).
autofocus: The HTML5 spec for doing this is the autofocus property of the input tag. But iOS ignores that, presumably for a cleaner UI that doesn't pop up the touch keyboard when navigating to a page. Here is a page that demonstrates the autofocus property. Before HTML5 you would call element.focus() in the window.onload event. However focus() calls are not supported on iOS except during the handler of an onclick event.
Note: this answer is old and may not be relevant to newer versions out there...
It comes as no help to you but the last poster in this thread wrote that its a bug of the webkit engine.
I can't tell if its a verified bug or not...
Last post from way back machine (as original seems to not work):
I am developing my app in pure XHTML MP / Ecmascript MP / WCSS. So
using native platform browser control api is really not an option for
me. Yes the behaviour u mention is the same as mine. I searched his
topic in the bugzilla at webkit.org and found that this indeed is a
reported bug. focus() to a text box does highlight the element but
does not provide a carat in it for the user to start entering text.
Using a timer as mentioned by "peppe#peppe.net" does not help either.
This behaviour is common across platforms (s60,iphone,android) which
use the webkit engine.
So as of now i dont see a solution to this problem.
Hope this helps
I have a similar issue, only my issue is that the focus will not occur on a 'touchend' event.
http://jsfiddle.net/milosdakic/FNVm5/
The following code will work in Chrome/Safari etc. but will fail on Mobile Safari. The only way to get it to work is to make the event on 'click', but seeing as the code is made for an iOS device, it would benefit for it to work with touch events.
It seems to be a bug with the Webkit engine.
If you are setting focus with from a click event, you need to preventDefault otherwise the click events default action will set focus on the clicked item.
A bit late maybe but for future person maybe. In our webapp running on iOS iPad (6 and more recent), we do it with a set interval:
startFocusOnTextField: function() {
this.intervalIDForTextFieldFocus = window.setInterval(function() {
document.getElementById(page.textInputFieldObj.id).focus();
}, 150);
},
Which is called on page load (jQuery mobile environment)
This is a workround:
setTimeout(function(){
input.focus();
},500);//milliseconds

Categories

Resources