Apple is taking active steps to block Facebook's data collection practices.

The Safari-maker said Monday that it will give users the ability to stop Facebook, Google and other platforms from tracking them across the web through "like" and "share" buttons.

The announcement is Apple's most significant counter yet to Facebook's data collection practices, and comes after years in which Apple executives have criticized Facebook as reckless with user privacy.

"We've all seen these like buttons and share buttons," Apple software VP Craig Federighi said at the company's annual developer conference. "Well it turns out, these can be used to track you, whether you click on them or not. So this year, we're shutting that down."

When Safari users arrive at a page with a Facebook like, a pop-up window will appear that asks: "Do you want to allow 'facebook.com' to use cookies and website data while browsing [this site]? This will allow 'facebook.com' to track your activity."

Facebook's chief security officer Alex Stamos immediately took issue with the move, questioning on Twitter whether it was a serious effort to protect privacy or "just cute virtue signaling."

Apple has put a premium on user privacy for years. In 2010, then-CEO Steve Jobs said Apple had "always had a very different view of privacy than some of our colleagues in the Valley."

"Privacy means people know what they're signing up for, in plain English and repeatedly," Jobs said. "I believe people are smart and some people want to share more data than other people do. Ask them. Ask them every time. ... Let them know precisely what you're going to do with their data."

Current Apple CEO Tim Cook has returned to this theme in recent months as Facebook has come under fire for its collection of a huge amount of user data and its failure to protect that data from abuse by third parties -- most notably Cambridge Analytica.

In an interview with CNN's Laurie Segall on Monday, Cook said, "I think that the privacy thing has gotten totally out of control and I think most people are not aware of who is tracking them, how much they're being tracked and the large amounts of detailed data that are out there about them ... We think privacy is a fundamental human right."

Facebook has made itself vulnerable to Apple's criticism. Less than 24 hours before Apple's conference, the New York Times reported that Facebook's data-sharing partnerships with device makers, including Apple, were still in effect despite Facebook's claim that they'd cut off such data sharing in 2015.

Meanwhile, Apple has seized the opportunity to cast itself as the best behaved player in tech. In addition to the new privacy measures, Apple also introduced new features that will encourage users to limit the amount of time they spend on their phones.

"[Apps] try to draw us in for fear of missing out," Federighi said. "We may not even recognize how distracted we've become."