For the best experience, please enable JavaScript in your browser settings.
Apple will attempt to frustrate tools used by Facebook to automatically track web users, within the next version of its iOS and Mac operating systems.
"We're shutting that down," declared Apple's software chief Craig Federighi, at the firm's developers conference.
He added that the web browser Safari would ask owners' permission before allowing the social network to monitor their activity.
The move is likely to add to tensions between the two companies.
Apple's chief executive Tim Cook had previously described Facebook's practices as being an "invasion of privacy" - an opinion Facebook's founder Mark Zuckerberg subsequently denounced as being "glib".
At the WWDC conference - held in San Jose, California - Mr Federighi said that Facebook keeps watch over people in ways they might not be aware of.
"We've all seen these - these like buttons, and share buttons and these comment fields.
"Well it turns out these can be used to track you, whether you click on them or not."
He then pointed to an onscreen alert that asked: "Do you want to allow Facebook.com to use cookies and available data while browsing?"
"You can decide to keep your information private."
One cyber-security exert applauded the move.
"Apple is making changes to the core of how the browser works - surprisingly strong changes that should enable greater privacy," said Kevin Beaumont.
"Quite often the changes companies make around privacy are small, incremental, they don't shake the market up much.
"Here Apple is allowing users to see when tracking is enabled on a website - actually being able to visually see that with a prompt is breaking new ground."
He added that the firm appeared willing to flash up a lot of prompts despite the potential for this to become annoying.
Stay informed. Subscribe to our newsletter
"Perhaps Apple is gambling on websites reining in tracking rather than users having to give constant permission to track their device," he added.
Apple also said that MacOS Mojave would combat a technique called "fingerprinting", in which advertisers try to track users who delete their cookies.
The method involves identifying computers by the fonts and plug-ins installed among other configuration details.
To counter this, Apple will present web pages with less details about the computer.
"As a result your Mac will look more like everyone else's Mac, and it will be dramatically more difficult for data companies to uniquely identify your device," Mr Federighi explained.
Analysis
By Dave Lee, North America technology reporter
Apple's attempts to block data tracking as you travel around the web could have a real impact on companies that rely on your personal information to make their billions.
And of course, where Apple goes, others often follow. So, if this keynote sets a trend, Facebook might have reason to worry.
Each demo showing these new tools used Facebook and Instagram - owned by Facebook - as the example of something you would want to block or at least restrict.
The question now is whether Facebook and other ad-tech companies will try to find new ways to trail our web activity, in an attempt to outsmart Apple.
Siri enhancements
Apple also overhauled its virtual assistant Siri to control third-party apps without users having to open them.
A new Shortcuts function allows device owners to assign their own phrases to different commands.
In addition, a single command, such as "I'm heading home" can be set to trigger multiple actions.
Although Apple was one of the first tech firms to offer a smart assistant, Siri is widely seen to have fallen behind its rivals in recent years.
Its new abilities appear to be an attempt to expand its capabilities without requiring the kind of personal data-sharing that Android requires to get the best out of Google Assistant.
"Voice assistants like Siri are critical because they are becoming a vehicle to a service," commented Ben Stanton, an analyst at the consultancy Canalys.
"If you think about booking taxis, ordering food or using social media, voice ultimately has the potential to overthrow today's app stores.
"That's a huge opportunity and why there's so much money being invested into voice assistants."
Siri's new functionality appears to build on Workflow, an automation tool that Apple acquired last year.
Another major addition announced for iOS 12 was Time Limit, which will allow users to pre-determine how much time they should spend using individual apps, and bring up a full-screen alert when an allowance is used up.
Although adults will be able to extend the period, they can also prevent their children from being able to do so.
Parents will also be able to get a breakdown of how long children are spending using different apps, block access at certain times of the day, and restrict the types of content youngsters have access to.
"Just as people know they eat too much junk food but keep on doing it, they also know they shouldn't spend hours buried in their phone but still do it," commented Neil Mawston from tech advisory firm Strategy Analytics.
"So, device-makers and app providers do have a responsibility to make sure their products don't become an addiction for consumers."
Google unveiled similar tools at its own IO developers conference last month.
Other announcements about iOS 12 included:
The next version of WatchOS - which powers the firm's smartwatch - will also gain new facilities.
They include the ability to automatically detect when a workout has begun, so that if the user presses start several minutes later they can still be credited with all their activity.
The firm also promised to launch Walkie-Talkie - a push-to-talk Watch app, that will let two users chat together via 4G or wi-fi.
It was first announced in September 2014, but had appeared to have been forgotten until now.
Apple TV also promised a feature previously teased: Dolby Atmos, which will allow compatible audio equipment to deliver improved surround sound by bouncing audio off the ceiling.
And the next version of the Mac operating system introduces a new dark mode for people who like the colour black.
"Some of us are going to want to run dark mode just because it is so cool, I mean your emoji look great," said Mr Federighi.