I know that typing
javascript:void(document.oncontextmenu=null) allows users to enable right click on a webpage
and javascript:void(document.onselectstart=null) should enable text selection if i'm correct?
but I tried typing these on http://www.pcworld.co.uk/gbuk/laptops-netbooks/laptops/apple-laptops/apple-macbook-pro-15-with-retina-display-21576115-pdt.html and it won't work.
by the way I typed it in the console of Google Chrome browser.
#Pointy pointed out that text selection worked fine for him. I tried in a few browsers - in Google Chrome specifically, on mouse down, the cursor changes when one tries to select text on a particular part of the page, and it does not allow this. However, on Firefox, you are perfectly capable of selecting the text.
For your intents, use a different browser and select the text.
For all we know, that sight could have custom javascript and logic preventing text selection, though its pretty lame that it doesn't work cross browser. But this custom logic is probably why your above mentioned commands aren't working.
Related
This question is a bit confusing and I am sorry I do not have any code to provide. I am just interested in knowing if this is generally possible or if it is a limitation of chrome extensions.
Currently, I am thinking of building a chrome extension which should have a "Manual Select button". When this button is clicked, users should be able to highlight (or select) text on the Chrome DOM using their cursor. The text they highlight or select should then be saved and displayed in the Chrome extension (I am guessing I will put that in local storage or something). The problem I am facing with this idea, is that I notice Chrome extensions close when you click away meaning the text you select will not be saved in the Chrome extension. Is there any way to force the extension to stay open even if you click away? Or, is there a way to have the extension still run the button's function logic while it is closed?
If this is possible and can provide some sudo code of how this would work it is greatly appreciated!
I would like to change the text that will be pasted without changing the selection's appearance on the screen, similar to what the Linux xsel command can do.
Ideally this would work on all platforms and browsers, but at the very least I want it to work on Chrome running on Linux.
My usecase is that I have a button that selects a block of shell commands from the web page (this is done by some library magic that I have no easy access to) and I want to add a terminating newline "behind the scenes" so that when the user middle-clicks in the console, he gets the text that appears highlighted on the screen plus a newline.
How to do it?
I have lots of rails and javascript code in one project. So far it works fine, but on one particular place Javascript is not working in Chrome, works in other browsers.
The form itself has a checkbox. Once it is selected it will enable textboxes on the form. On initial load, it is not enabling the fields. But as soon as I select "inspect elements" in Chrome, and close inspect elements window it starts working, javascript kicks in and works as it should.
There is so much code behind, that it would be really difficult to post it here. I am hoping there is some "magic" only specific to Chrome.
Did anyone ever had this kind of problem before?
The scenario, I have an input text field I'm doing partial auto-complete on (exactly like the Tags input field on Stack Overflow... because that's what is, basically).
As a user is typing, I suggest things they may typing; the user then clicks one the suggestions, it replaces a bit of the fields content, and places the cursor after where the insert occurred.
All this works, but after the insertion the software keyboard isn't shown anymore. You can replicate this on the desktop Stack Overflow site.
The code on SO isn't exactly the same, though the symptom is.
Here's the actual code called after the text is inserted into the text field.
$(field).focus()[0].setSelectionRange(newCaretPos, newCaretPos);
(Yes yes, setSelectionRange is non-standard; but it works on all the mobile devices I care about just this moment, so ignore it for now)
On android, iphone, etc. this works fine (the keyboard "flickers" but I'm willing to live with it.
So, the question basically boils down to: How can I force the onscreen keyboard to appear on Windows Phone 7 (Mango update)?
Sorry, there is no guaranteed way to force the SIP to display in WP7. :(
Normally setting the focus on the textbox would force the keyboard. Have you tried just setting the focus? (i.e. not setting the selection range)
I'm developing a Chrome extension that injects JS code into all opened tabs. The task of this code includes displaying a textbox, implemented as a contentEditable <div> to allow formatting. However, the contentEditable element doesn't play well with some websites, e.g. Twitter.
Try it yourself:
Go to twitter.com
Paste javascript:document.body.setAttribute('contentEditable', true); in the address bar and hit enter.
Click anywhere in the document - you should now be able to edit the text.
Try typing a j or k. You will see: The character does not appear, instead, the selection is moved (a tweet in the list will be highlighted).
I have tried hard to find out how Twitter's keyboard navigation is implemented, but could not find any hints. Can you give me any tips on how to solve this problem (and avoid similar problems on other websites)?
Using an iFrame for the input triggers some other, very weird bugs, so I want to avoid that if it's possible.
Please make sure you don't have installed vim keyboard extension on google chrome.
J and K are then used for navigation shortcuts. (up/down).