I'm getting started on a module for my website, looking for a method that extends flash (for example, something I can do with JavaScript) to disable keyboard commands. For example, I'd like to be able to disable the F1 key, so that it doesn't open up the support tab in Chrome. I looked into access keys, but they don't seem to be a good solution. If anyone has info on how this may be possible, even which language I should be looking into, or even if they have attempted it and simply found it to be impossible, please let me know.
I am not sure if other browsers then Chrome works for you, but have you tried some of these solutions?
[1] How to disable default Help function of browsers
[2] Disable F1-Help key in browser and set your own help file or link or pages etc...
[3] How to Disable Function keys using Javascript?
Related
Long time automation developer here (just for context).
It's been bugging me for quite a while that the dev tools in chrome used to find elements just don't seem to work as I expect. Hopefully someone can point out what I'm doing wrong.
Looking at , say, sauce labs page: https://saucelabs.com/blog/selenium-tips-finding-elements-by-their-inner-text-using-contains-a-css-pseudo-class
ok now that page has div's and anchors
and indeed I can do find ('a') or find('div')
but why do I have a problem using classes or id's ?
The find() method refers to window.find(), a non-standard API for the browser's built-in Find function. It does not find web elements the same way Selenium or Capybara do, and so it does not parse the input as a selector.
You find elements with selectors in Chrome DevTools using document.querySelector() or document.querySelectorAll(). There are no special methods in Chrome DevTools for this, however it does provide the $() and $$() aliases (respectively) to save you time and keystrokes.
You can use jquery code in chrome console, for example if you want to find something with class of "foo" you can write $('.foo') or a id of "bar" you write $('#bar')
You can read all about it here
Also you can just google what you want "Jquery how to find a div with id"
My Fellow Community - I am in some need of assistance here. I am certain this is something simple, but am just missing the mark. So please help.
Scenario:
On Mac OS X 10.7 or greater, I have a webview as a browser. In that webview I navigate to Gmail. In Gmail I compose a message and then drag and drop one or more files into the compose box.
Actual Results:
The pasteboard has NSURL object(s) and the webview simply takes the absolute string value and pastes it into the composed message body. For other edit areas like the search bar and such this behavior is accepted.
Desired Results:
It is desired that the drag triggers the HTML5 when mousing over and the drop will trigger the proper javascript to upload the files. This behavior is consistent with how FireFox, Safari, and OmniWeb perform.
How do I get this same consistent behavior / What do I need to implement?
What I have tried so far:
Using the WebView Editing Delegate I tried replacing the markup in the DOMRange
I subclassed WebView to override performDragging: and modify the DraggingSource pasteboard
Turned on LocalStorage using the WebView preferences private methods
Note: The app will be sandboxed and currently is not code signed.
So what am I missing or better yet where do I start and end?
P.S. I have tried so many things, I didn't want to clutter this question up with the useless code snippets I have tried thus far. However, if solved I will post my results for all others.
Boy I feel silly. The solution was simple, but not obvious.
The answer is it was the user agent string for the webview.
Here is a link of helpful info.
http://www.useragentstring.com/
I recommend you put your useragent string to analyze and make sure it conforms.
Take the following example:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/xxx.x.x (KHTML, like Gecko) MyApp/x.x.x Safari/xxx.x.x
Note: The 'xxx.x.x' is the app kit version (I won't get into details about this).
The fix is the identifier there at the end 'Safari'
Others work to such as Firefox
Happy coding! Really hope this helps someone out.
Let's say someone is writing a reply to an online forum on their iPhone when they lose connection.
Is it possible to use HTML5 local storage to save their submission and post it when they get connection back?
If so, how do I tell if the phone has a connection or not?
Yes you can by implementing your custom logic into the app.
To see if a connection is available you could either use navigator.onLine flag (but it seems that is not completely reliable):
Does Safari and/or WebKit implement the equivalent of window.navigator.online?
http://html5demos.com/offline
or try to load content from the internet and see if it's possible or not:
Checking online status from an iPhone web app
Could you not use JavaScript to set a variable and make it a string with the content of whatever the user puts in the box? You could use getElementById or similar to get the content from the form.
Then, store it in a "cookie". If you don't know how to do this, here is a quick run down on javascript cookies from w3: http://www.w3schools.com/js/js_cookies.asp
Then on page load you could have it load the cookie and make the value of the form equal to the variable you declared earlier.
The best approach (in the light of navigator.onLine behaving inconsistently in different browsers) would be to save whatever the user is typing to localStorage every few seconds or every few keystrokes.
If the page is reloaded again, then you can make sure to first see if there is anything stored in the localStorage key, and if so, then load that into the text box and the user can continue from where he left off.
You can also take a look at the 'going offline with web storage' section of this article http://dev.opera.com/articles/view/taking-your-web-apps-offline-web-storage-appcache-websql/
I have developed a NPAPI plugin(npruntime) for windows browsers like firefox, safari, Google chrome.
My question is how one can read the values specified in the tag of the element in a plugin.
Is there any way to access these values in a plugin.? I searched a lot for this and unfortunately didn't get any help.
We can read the tag attributes likes "type", "width" etc in NPP_New function.
Thanks in advance.
regards,
Sanjay
You get the tags in the NPP_New function as well; they're all in the same place. Are you familiar with FireBreath? It abstracts all of this for you and works on IE as well.
You can find the code that FireBreath uses to pull the params out here: https://github.com/firebreath/FireBreath/blob/master/src/NpapiCore/NpapiPlugin.cpp#L76
(that function is called from NPP_New)
Hopefully everyone knows the benefit of setting the HTML accesskey property on input-fields and buttons (and various others): It makes the page easy to navigate by enabeling shortcuts (in IE by pressing 'Alt' and the accesskey).
My problem is now that I have been asked to look into extJS for building our forms (and web stuff en general) as this is delivered with our IceBreak server.
I've been able to build a form and at first I figured that I must be able to set the accesskey the same way as all the other properties... but that does not seem to be working =0/
I can see in How to implement accesskey on ExtJs tabs? and http://www.sencha.com/forum/showthread.php?22812-AccessKeys-(Global-keymap) that it is possible to make something similar to accesskeys, but they seem a lot like work-arounds to me.
I just need for Alt and 0-9 or a-z to focus/active the elements. Nothing more fancy than that.
Is there a SIMPLE way of getting extJS to set the accesskey? (preferably on the html-element)
I was about to suggest using the KeyMap component, but I see that the forum links already do that. I have used the keymap object before to create keyboard shortcuts in the past. We replicated the keyboard shortcuts that existed in the thick-client legacy application we were replacing.
If you follow the guidelines in the links you posted, that should get you to where you are going. Following this method is what you'll need to do.