Copy text from a spotify application - javascript

My application generates a link from the song that is currently playing. My idea is to set a button with a click event that copy the link to the clipboard.
I've seen solutions like zeroclipboard but flash isn't allowed, so it should be just javascript.

From what I can remember, this only works in Flash. I think the best workaround is to put the text in an input box and instruct the user to copy it manually.

Yeah... Don't do that.
Train your users to use drag-and-drop (which works fine for HTML links without any "clever" hacks). They will thank you for it.
If you can't achieve what you want with drag-and-drop, submit a bug against the application you're trying to drag-and-drop into.

It's not going to work:
>> document.queryCommandEnabled('Copy')
false

Related

Codio Guide Throbber: Is there an open source jQuery version?

Codio has a cool feature which I think is called Guide Throbber. When you log in for the first time you'll see various throbbing buttons around the page which act as 'help hints'. Clicking one of these buttons shows a popover that contains help text. Once a throbber has been clicked, it never shows again.
To the best of my knowledge, this feature is proprietary to Codio. Is there an open source jQuery or JavaScript version available?
I actually wrote the code for the throbber on Codio, and yes it is proprietary code, but there is no reason why we couldn't open source that, but no idea when I would get the time ;)
I don't know of any open source libs that can do this.

hide source of HTML page using javascript

I saw How to hide html source & disable right click and text copy? . One of the answers say use ctrl+u to view the source. But, using shortcut.js I can override ctrl+u as well. How do I view source in that case.
There is no way to prevent this. Someone could easily download the page using a non-browser tool like curl or wget, or log all HTTP traffic with Wireshark.
Use this. http://www.fiddler2.com/
Depends on the browser, but you can go to View -> Page Source in most to view the source. You cannot override that, however.
Furthermore, it's considered bad practice, and someone could also just as easily override the functionality through a tool like Firebug.
You can't stop people. It will be passed over the network, and sniffable through Fiddler, or someone can use a text based browser, or disable Javascript entirely, or look through their cache folder for the files they downloaded from your site.
You cannot stop people from seeing your source.
Well it's not possible to prevent users from seeing your script. But what you can do is to make it mire harder that user quits trying after few common methods.
I recommend you to load an initial page. Then load the whole page by using ajax. You can show a friendly loading gif too. This technique has following adanages,
browsers don't show generated HTML. Developers knw how to see this. But Normal user will not find it easily
if any user just press Ctrl+u it'll show the initial page.
wget, curl tool will not work at the first time.
additionally you can obfuscate the main page (which you are going to load by Ajax).
It's nearly impossible to stop people fetching the HTML from your website. I don't see any reason you'd want to hide it in the first place anyway. Hiding something?
Want to view the source no matter what javascript is being used to hide it? cURL the page.
Even if you disable right-click, you can still do a snapshot by pressing the prt scrn key on your keyboard then pasting it into an image editor.
You can't disable it. There are ways to encrypt it, but way more trouble than it's worth.
It's impossible to hide the source, HTML and Javascript are interpreted languages, that mean the browser will "compile" the code on the clients machine.

How to know if something is programmed in Flash or Javascript

I was looking for examples of Javascript games and I came across this. It looks like Flash. I tried looking at the source code, and all I see are a bunch of div tags, but not really any Javascript. I couldn't find the code that actually runs the game.
Is this Flash or Javascript? How can you tell?
It's Javascript.
When you right click it gives you the native browser context menu. Right-clicking anything in Flash will give you a Flash context menu. The only time that method fails is when you get no context menu at all.
Also, highlight the text "Press enter". It uses native text highlighting.
As far as I know is impossible to hide the typical secondary flash context menu telling the version, etc...
I found is using a core.js javascript
Hope it helps.
You can try to disable the plugin of shockwave flash from browser's options. Then refresh page and see, whether 'target flash' disappears. If so then it was flash.

Can a piece of code be dynamically placed on every webpage a user visit

So we have a program that the user can use by copying text from a webpage they visit, alt+tabbing to the program, then pasting it as input. It would be more convenient for users to be able to do it directly in the site.
We were thinking of a panel that would be small and expandable, following them to each site they visit. Is this possible? Either a snippet of code that is auto pasted, or a JavaScript command called that would dynamically paste the code (is Scratchpad any help here, at least in FireFox).
We've never made a FF add-on, but it seems like if the dynamic panel idea falls through, an add-on would be the next best thing.
Basically, users should ideally be able to copy text, either enter a key combo or click a button, see the interface and paste in the text. Would either of these methods work?
A browser add-on or a userscript could certainly do this.
You can also write a userscript and use a user script compiler (such as this one) to convert it to a "true" Addon.
Alternatively your application could act as a HTTP proxy and inject it dynamically, but I'd guess that this would probably be more complicated than the other two approaches.
This site Polyvore used to do something similar, although in the 2 mins hunting around I could not find it, but I have used it and I think the technique was used by Google and Digg for a while. From what I recal it involved iframes and a bookmark in your browser.
Basically you could download a small piece of code that would sit in your bookmarks bar and this would allow you to navigate to a fashion website click on the bookmark copy a picture and insert it back into Polyvore.

Disabling "block selection" on an iPhone

I am building an app for iPhone that has JavaScript running in a webview. When the new auto-select block selection tool is used to select text, and the block is resized from the side, it makes my JavaScript freak out. Does anyone know a way to disable the copy/paste for block selection? I still need to be able to select the text, just not using the big selection tool.
Thanks
To my knowledge, there is nothing in the UIWebView API to allow this. Your best bet is probably to tweak it from the JS side of things.

Categories

Resources