News for hackers. Stuff that matters.
Re:Clipboard.js: Modern Copy to Clipboard by hayksaakian on Wednesday September 30, 2015 @03:27AM (#10302322)
I was thinking -- why isn't this more common?

Then I read the bottom of the readme, and noticed safari was holding back webdev once again.

I've been casually following this for the last 5 years and it seems almost too convenient that safari is regularly behind on mission critical features.

Re:Clipboard.js: Modern Copy to Clipboard by pdkl95 on Wednesday September 30, 2015 @08:00AM (#10303259)
More common? It shouldn't exist at all. The potential use cases for manipulating the selection are at best a minor feature and sometimes a serious usability bug.

Stop trying to give webpages control - any control at all - over the browser UI. The page gets to control just that (the page) and the framework around that page (the browser). Any violation of this a potential security problem. Any time the demarcation between "remote page" and "browser UI" is blurred, problems such as "phishing" attacks become easier.

If you want fancier UI than is possible from a web page, write a native app.

Re:Clipboard.js: Modern Copy to Clipboard by eponeponepon on Wednesday September 30, 2015 @08:16AM (#10303324)

    Any time the demarcation between "remote page" and 
    "browser UI" is blurred, problems such as "phishing" 
    attacks become easier.
Hugely important; largely ignored.

Unfortunately, people whose training and experience exists only inside a browser either don't or can't see beyond those confines and the result is reimplementing perfectly adequate external functionality.

Re:Clipboard.js: Modern Copy to Clipboard by henvic on Wednesday September 30, 2015 @12:29PM (#10305091)
This is indeed a nice argument.

Sometimes I am doing something on the CLI and go back to the terminal and paste a text I copied from somewhere.

If the text is multiline my terminal will consume the lines without requiring an extra 'enter / return' key press.

Another possibility is copying something to web mail client without noticing there's something suspicious about it (JS isn't the concern here anymore nowadays, but loading stuff like images is a privacy concern).

However, this issue MUST be fixed at browser level. And when used without destroying user expectations / UX, this plugin is useful.

Malicious attacks are going to happen anyways if the browser permit such action to happen, so don't blame the plugin or the plugin writer. The browsers are broken. Ask the major browser developers to either never allow it to happen (like Safari does) or ask them to ask for permission (like for webcams) or add a confirmation modal.

Re:Clipboard.js: Modern Copy to Clipboard by pdkl95 on Wednesday September 30, 2015 @03:41PM (#10306561)
re: browser support (which is where this problem should be fixed)

A trivial compromise that would be even easier to use than the current javascript/selection stuff would be a "copy to clipboard" variant of the <button> tag. Something like this should satisfy the use-cases where this clipboard nonsense is occasionally useful:

    <form>
      <input name="copy_souce" type="text" value="xyzzy" />
      <button type="clipboard" value="copy_source"
              name="Copy To Clipboard" />
    </form>
This wouldn't require any Javascript, and leaves the clipboard entirely under the control of the user where it belongs.

This could even be extended to allow copying of the various types of input tags, and if you wanted to get fancy, the button could reference an #id and copy that element's textContent (or innerHTML).

Re:Clipboard.js: Modern Copy to Clipboard by stephenr on Wednesday September 30, 2015 @04:03PM (#10306704)
Or people could .. You know... Use their platforms existing copy functionality.

I know it's only existed on desktop computers since the Apple Lisa, and 30 years isn't very long for people to grasp the concept of copy and paste without a button to do it, but I have faith in people.

Re:Clipboard.js: Modern Copy to Clipboard by henvic on Wednesday September 30, 2015 @06:13PM (#10307776)
This button couldn't be customized, otherwise it's useless as someone could easily get away with hiding it / showing only a small portion of it where someone could click without even noticing / etc.

Maybe a small modal-like confirmation that can be placed anywhere on the viewport and is actually on top of everything natively (like Safari's copy/paste on iOS).

Of course, this modal-like confirmation must not be customized or its effect is useless.

Or let's just forget entirely and remove the functionality from the browsers.

Re:Clipboard.js: Modern Copy to Clipboard by leephillips on Wednesday September 30, 2015 @08:33AM (#10303404)
An HTML5 page with no stylesheet or javascript is hugely functional, legible, and responsive, adapting itself to any device. If there is a problem with a website it's because a "web designer" or front-end developer broke it.
Re:Clipboard.js: Modern Copy to Clipboard by sanderjd on Wednesday September 30, 2015 @12:41PM (#10305201)
This seems to be a civil war taking place purely amongst software developers. Some developers want the web to be used for hypertext documents as it was originally intended, and others want it to be used for anything for which there is demand amongst a sizable group of people, technical and non-technical alike. I see the appeal of the first viewpoint, and it's likely I would share it if I had the luxury of working on non-web software, but as it is, most of us go where the users are and work on what the users want, and that question has been settled: they want rich functionality that looks nice and is delivered through the web on their desktop and a mix of web and native apps on mobile. Only other programmers (and only a small subset of programmers at that) complain about javascript and stylesheets. In most cases, it doesn't make sense to pander to such a tiny audience.
Re:Clipboard.js: Modern Copy to Clipboard by acdha on Wednesday September 30, 2015 @02:36PM (#10306099)
I think the situation is more nuanced than that: users may not know the terms to complain about JavaScript and stylesheets but they know when a page is slow or broken.

The discussion really should focus on how well apps degrade, which is really reaffirming that progressive enhancement is still the best approach to building web apps. While only a small percentage of users have intentionally disabled JavaScript entirely, it's effectively disabled for everyone while it's downloading and a larger percentage of users (particularly on mobile) will have errors which prevent those downloads entirely. If you build a rich application which still has the core functionality working, you've done a much better job than the people who make sites which take minutes or don't even render when their shiny framework hits a non-perfect network connection.

Re:Clipboard.js: Modern Copy to Clipboard by sanderjd on Wednesday September 30, 2015 @03:49PM (#10306626)
This is a really good point, and the better conversation to have than broad brush dismissal of anything but raw hypertext like the comment I replied to. Graceful degradation is a user-friendly, competitive, and all around fantastic feature. It is also expensive, and may or may not belong at the top of the list of things to optimize to improve user experience. Eliminating everything but raw hypertext may be a cheaper solution, but it isn't a good one.
Re:Clipboard.js: Modern Copy to Clipboard by leephillips on Wednesday September 30, 2015 @05:57PM (#10307676)
I did not advocate eliminating anything but raw hypertext. I like CSS and javascript when they are used well. I like web apps.
Re:Clipboard.js: Modern Copy to Clipboard by sanderjd on Wednesday September 30, 2015 @06:22PM (#10307833)
Fair enough! I misread.
Re:Clipboard.js: Modern Copy to Clipboard by draw_down on Wednesday September 30, 2015 @02:33PM (#10306077)
Phishing is really more about web pages impersonating other web pages. I disagree that this functionality enables or facilitates phishing.
Re:Clipboard.js: Modern Copy to Clipboard by jacobolus on Wednesday September 30, 2015 @04:10AM (#10302465)
Funny. I find Safari leaps ahead of Firefox, and even further ahead of Chrome, when it comes to browser performance (CPU use, memory footprint, and especially battery life), with snappier scrolling and animations and fewer weird graphical glitches or mouse/keyboard interaction bugs. For my own browsing habits, Firefox is very sluggish, and Chrome is completely unusable: it just can’t handle the load and brings my whole computer to a crawl. The Safari user interface also feels much more platform-native and predictable (though it has unfortunately copied several Chrome UI elements in the last few years, which I think make the basic UI worse than ~5 years ago), and I don’t constantly feel like someone is trying to gather and analyze my keystrokes or sell me out to advertisers. (I don’t have a Windows machine, so I couldn’t tell you what IE is like these days.)

Maybe there’s just a focus on different things between vendors: Google has tons of 20%-time engineers pushing new half-baked features in every direction (yes this is a bit of a caricature), while Apple is taking a more measured approach with a focus on performance and reliability.

Re:Clipboard.js: Modern Copy to Clipboard by huskyr on Wednesday September 30, 2015 @04:58AM (#10302627)
> (...) while Apple is taking a more measured approach with a focus

> on performance and reliability.

Good luck then trying to do anything complex with video and audio on iOS Safari. I've seen many weird quirks and bugs, strange limitations (videos always playing fullscreen on iPhone) and even browser crashes.

And considering reliability: wouldn't you agree that we would be better of using a native solution for clipboard access than the buggy and insecure Flash fallback that's needed for Safari?

Re:Clipboard.js: Modern Copy to Clipboard by awjr on Wednesday September 30, 2015 @05:04AM (#10302649)
iOS8 release completely blew any confidence I had in Apple. They broke so much in Safari and caused an immense amount of work. IIRC web workers broke after sleeping the screen. That one was a huge problem.
Re:Clipboard.js: Modern Copy to Clipboard by NicoJuicy on Wednesday September 30, 2015 @06:14AM (#10302848)
You are in my experience 80 % wrong ( ahead of Chrome / Firefox). I develop webapplications at my work.

The only thing that Safari is good at is memory footprint and batterly life.

An objective view: https://html5test.com/results/desktop.html

Re:Clipboard.js: Modern Copy to Clipboard by jacobolus on Wednesday September 30, 2015 @06:39AM (#10302926)
That’s not an “objective view”. It’s just one particular dude’s feature comparison chart, without any attempt to judge or explain the merits of the features involved or the quality of implementations.
Re:Clipboard.js: Modern Copy to Clipboard by NicoJuicy on Wednesday September 30, 2015 @07:47AM (#10303190)
It's more objective then what you wrote, because what you wrote comes down to:

Safari is better then everything and all the rest doesn't come near. The features that it copied from Chrome made Safari worse and at they don't spy on me or sell me to advertisers.

Note: Apple has iAd and does the same, it just doesn't want Google to do it.

At least i wrote some pro's for Safari... And it's a live feature tester for HTML 5 according to the W3C HTML 5 specifications, and safari lags far behind. It runs all the test cases and the best browser comes on top. The worst browser falls behind.. In this "objective" test, Safari falls short and Chrome, Opera and Firefox are much better.

So yes, it is much more objective then your opinion ;-)

Re:Clipboard.js: Modern Copy to Clipboard by bwohlergo on Wednesday September 30, 2015 @09:01AM (#10303553)
you know of a better page than html5test?

please, enlighten us.

Re:Clipboard.js: Modern Copy to Clipboard by anon1385 on Wednesday September 30, 2015 @11:05AM (#10304486)
The point is that 'more features' isn't necessarily better[1], so no list of html5 feature support is going to tell you much about how 'good' a browser is.

[1] case in point: the misfeature we are discussing in this thread, which is just another addition to the big list of browser features that I have to go out of my way to disable to get a sane experience that minimises my exposure to the incompetence of web developers

Re:Clipboard.js: Modern Copy to Clipboard by NicoJuicy on Wednesday September 30, 2015 @04:45PM (#10307016)
More features for web applications mean a faster distance from mobile native applications.

That is (according to me) the true reason why Apple doesn't add features to Safari ;)

Re:Clipboard.js: Modern Copy to Clipboard by rockdoe on Wednesday September 30, 2015 @04:57AM (#10302626)
Is it possible you're having this experience because Safari just is ignoring a whole bunch of stuff (that makes the web-pages slow and cumbersome) because it's too outdated to understand?

Battery life it does have an advantage on, AFAIK this is widely understood and both Google and Mozilla are trying to address it (if they can, Apple does have nonpublic/undocumented APIs...). I'm surprised you find it outperforming Firefox wrt memory usage, though.

Re:Clipboard.js: Modern Copy to Clipboard by dota168 on Wednesday September 30, 2015 @12:05PM (#10304918)
You probably ain't a web developer.

Safari is so behind even compared to IE.

Same as this project. DataTables filters out Safari for some of it's extension:

https://github.com/DataTables/Buttons/blob/master/js/buttons...

Re:Clipboard.js: Modern Copy to Clipboard by ucaetano on Wednesday September 30, 2015 @05:08AM (#10302663)
It's just business: Apple makes no money from browsing, Google does.

It is in Apple's interest that people don't browse at all, and spend their time inside apps, where Apple has a much bigger chance of getting revenue sharing.

They are deprecating the browser, on purpose.

[Edit: this doesn't mean Apple is bad, they are just a rational company; it would be weird if they weren't doing it]

Re:Clipboard.js: Modern Copy to Clipboard by Oletros on Wednesday September 30, 2015 @05:15AM (#10302687)
> For my own browsing habits, Firefox is very sluggish, and Chrome is completely unusable: it just can’t handle the load and brings my whole computer to a crawl.

Any example of those pages that brings the computer to a crawl?

Re:Clipboard.js: Modern Copy to Clipboard by jacobolus on Wednesday September 30, 2015 @05:33AM (#10302734)
It’s not any particular page that makes Chrome die. It’s opening more than 30 at a time. (I typically have anywhere from 50–200 browser tabs open at once.)
Re:Clipboard.js: Modern Copy to Clipboard by darrhiggs on Wednesday September 30, 2015 @05:56AM (#10302800)
Do you use task manager (Hotdog menu > More tools) to kill tabs that you are not currently using? Also chrome 46 looks to be getting much better[0]; although I have also noticed a sizeable improvement with 45.

[0] http://thenextweb.com/apps/2015/08/20/chrome-is-finally-gett...

Re:Clipboard.js: Modern Copy to Clipboard by Oletros on Wednesday September 30, 2015 @06:59AM (#10302990)
Thanks
Re:Clipboard.js: Modern Copy to Clipboard by runako on Wednesday September 30, 2015 @09:30AM (#10303764)
Anecdotally, leaving open for long periods of time causes problems, when that tab tab that includes Flash. Since Flash is fairly prevalent among Web ads, etc., it basically happens all the time.

I'm sure there's some configuration setting or extension I could use to change this behavior. However, switching to Safari fixes it as well (and gets me improved battery life overall). I haven't really noticed any downsides to using Safari vs. Chrome.

Re:Clipboard.js: Modern Copy to Clipboard by Shengbo on Wednesday September 30, 2015 @05:34AM (#10302736)
I'm going to assume 100+ open tabs.
Re:Clipboard.js: Modern Copy to Clipboard by yAnonymous on Wednesday September 30, 2015 @03:33AM (#10302343)
I mostly ignore Safari by now. I work around its worst limitations so the sites are usable, but that's it.

Safari is the new Internet Explorer.

Re:Clipboard.js: Modern Copy to Clipboard by babuskov on Wednesday September 30, 2015 @01:05PM (#10305410)
Let's see... Comes preinstalled with OS, has small memory footprint, very fast loading, low CPU usage and shitty support for newer web tech.

Yup, all checks out.

Re:Clipboard.js: Modern Copy to Clipboard by moretti on Wednesday September 30, 2015 @06:32AM (#10302903)
So Safari is holding back webdev because it doesn't support an experimental technology?

Fun thing: the author of the Selection API draft works for Apple :-)

http://www.w3.org/TR/selection-api

Re:Clipboard.js: Modern Copy to Clipboard by realityking on Wednesday September 30, 2015 @07:54AM (#10303229)
The Selection API works in Safari, what doesn't work is the clipboard API.
Re:Clipboard.js: Modern Copy to Clipboard by davidcollantes on Wednesday September 30, 2015 @07:17AM (#10303064)
It is working on Safari for me.
Re:Clipboard.js: Modern Copy to Clipboard by code_sterling on Wednesday September 30, 2015 @07:13AM (#10303046)
Hardly. Different priorities. Safari on Mac is miles ahead on battery life and footprint. When I'm on a laptop, that matters way way more than any experimental feature. It's literally hours better.

I have to ask though, what mission critical ratified features do you need that Safari lacks?

Re:Clipboard.js: Modern Copy to Clipboard by atirip on Wednesday September 30, 2015 @06:33AM (#10302908)
Why isn't this more common?!? Are you trolling? Every script copying random stuff (read marketing messages) into my clipboard, well sign me up, thats what i have sooo wanted for sooo many years. Luckily Safari is my browser of choice.
Re:Clipboard.js: Modern Copy to Clipboard by joshstrange on Wednesday September 30, 2015 @09:28AM (#10303744)
IIRC the clipboard copy only happens if you first click so it must be user-initiated. Now I'm sure using flash there are other sneaky ways to do it. For example some sights when you select text and copy it will attach the URL of the page your are on at the end of the text which drives me crazy. If I want the URL I'll copy it, until then stay out of my way.
Re:Clipboard.js: Modern Copy to Clipboard by lexicalscope on Wednesday September 30, 2015 @04:31AM (#10302523)
I actually was thinking that the graceful degrade was how it was implemented initially and was about to write it off until I got to that part. Interesting.

At this point I still don't buy that Apple is doing this to hold things back. Do you have other examples of when they've been behind on features with no clear explanation of why? It's okay if not - you said you were only casually following - but curious.

They wouldn't have very much to gain in my mind - none of their core business relies on locking in/out web development. They have an app market, and I guess you could argue they're trying to drive that, but they have implemented a lot of other features, and early extensions in many cases, that doesn't really align with them trying to hold web back.

Re:Clipboard.js: Modern Copy to Clipboard by circlingthesun on Wednesday September 30, 2015 @04:53AM (#10302608)
Well, for one, local storage in private mode has been completely borked for at least for a couple of years now.
Re:Clipboard.js: Modern Copy to Clipboard by progx on Wednesday September 30, 2015 @03:37AM (#10302358)
Seems we have a new IE 6
Re:Clipboard.js: Modern Copy to Clipboard by michaelwww on Wednesday September 30, 2015 @10:07AM (#10304029)
I came across an article yesterday that said this too. I don't know, I am not a Safari user, but I doubt Apple will take years to upgrade like IE6. http://nolanlawson.com/2015/06/30/safari-is-the-new-ie/
Re:Clipboard.js: Modern Copy to Clipboard by cpeterso on Wednesday September 30, 2015 @01:07PM (#10305420)
ZeroClipboard is adding support for the HTML5 clipboard API , while retaining Flash fallback for older browsers:

https://github.com/zeroclipboard/zeroclipboard/issues/171

Re:Clipboard.js: Modern Copy to Clipboard by fokinsean on Wednesday September 30, 2015 @01:38PM (#10305661)
Yup, Safari's lack of getUserMedia() is the sole reason we have to continue using flash at my job.