Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs - Gadget Hacks

2 years ago 50

Safari conscionable got a large caller diagnostic connected your iPhone — thing that volition alteration the mode you share, receive, and interact with links.

1. The Basics of URL Fragments

You've astir apt travel crossed it galore times: a webpage with a array of contents that links straight to circumstantial parts of the webpage. Wikipedia is celebrated for it, and it makes hunting for accusation easier erstwhile you cognize what you're looking for. You conscionable pat oregon click a nexus to leap to the close spot without having to scroll down and find it yourself.

Without going into excessively overmuch detail, these leap links are acknowledgment to fragments, an optional portion of a URL that comes aft the scheme, authority, path, and query parts. The fig motion oregon hash people (#) is the fragment identifier, and what follows it links to a circumstantial conception of the web document. These are coded into the webpage, heavy linking to a peculiar "id" attribute, truthful conscionable typing a # followed by a connection oregon operation won't bash thing unless you're utilizing the assigned anchor tag by the web developers.

https://en.wikipedia.org/wiki/WonderHowTo#WonderHowTo_Network |___| |______________||_______________||__________________| | | | | scheme authorization way fragment

Gadget Hacks besides uses URL fragments to leap you consecutive to important parts of an nonfiction erstwhile you pat oregon click the hyperlink. For example, the nexus beneath takes you straight to the ninth spell successful our usher connected Harry Potter spells for Siri.

https://gadgethacks.com/how-to/potter-spells-0384951#jump-9heysirihomenumrevelio

These links are precise adjuvant erstwhile navigating the web, but not each website uses them. That's wherever substance fragments travel in, a projected specification by the Web Incubator Community Group (WICG) that lets you nexus oregon spell to a circumstantial portion of astir immoderate webpage without the request of embedded anchor tags.

2. Text Fragments Make Life Easier

The projected substance fragments specification has already been adopted by Google Chrome since aboriginal 2020, and it besides works with Microsoft Edge. Mozilla Firefox is not currently supporting it, but Apple has yet jumped connected committee with Safari 16.1, which comes with the iOS 16.1 update connected Oct. 24. (It's besides disposable connected iPadOS 16.1 and macOS 13 Ventura, which are besides coming soon.)

Text fragments' syntax is beauteous simple, arsenic seen below. It starts with the # arsenic bash each fragments, past uses :~:text= (the fragment directive) to bespeak the pursuing percent-encoded substance should beryllium found, highlighted, and instantly scrolled to automatically. There are besides a fewer different options to assistance you item a full artifact of substance oregon find circumstantial substance alternatively of its archetypal appearance.

It is reserved for idiosyncratic cause instructions, specified arsenic text=, and is stripped from the URL during loading truthful that writer scripts cannot straight interact with it. User cause instructions are besides called directives. In the factual case, text= is truthful called a substance directive.

#:~:text=textStart Links to and highlights the first lawsuit of an nonstop substance match. #:~:text=textStart,textEnd Links to and highlights a artifact of substance that starts with the word(s) earlier the comma and ends with the word(s) aft the comma. #:~:text=prefix-,text Links to and highlights the text aft the comma, with the prefix- word(s) helping to find the close substance (when the text appears aggregate times). #:~:text=text,-suffix Links to and highlights the text earlier the comma, with the -suffix word(s) helping to find the close substance (when the text appears aggregate times). #:~:text=prefix-,text,-suffix Links to and highlights the text betwixt the commas, with the prefix- and -suffix word(s) helping to find the close substance (when the substance appears aggregate times) #IDattribute:~:text=AnyOfTheAbove Links to an anchor tag embedded connected the papers and highlights immoderate fragment substance style you choose; The anchor tag acts arsenic a backup against future substance changes by the author.

3. Text Fragments connected iOS 16.0.3 and Earlier vs. iOS 16.1

The leafage loads connected iOS 16.0.3 and earlier erstwhile a URL formatted with substance fragments is opened, but thing peculiar happens (left GIF below). With Safari connected iOS 16.1, the unsocial URL formatted to item circumstantial substance connected the webpage jumps close to that portion of the article, highlighting the substance (right GIF below).

Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Not moving connected iOS 16.0.3 and earlier (left) vs. moving connected iOS 16.1 (right).

4. Example Uses of Text Fragments

The beneath nexus to our database of Harry Potter spells for Siri takes you straight to the words "the human-presence-revealing spell" for the ninth spell.

Example of #:~:text=textStart ----------------------------- #:~:text=the%20human%2Dpresence%2Drevealing%20spell Link ---- https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=the%20human%2Dpresence%2Drevealing%20spell

The pursuing links item the full paragraph of the ninth spell earlier the bulleted actions. While the ampersand (%26) and comma (%2C) characters should beryllium percent-encoded, play (%2E), dash (%2D), and quotation people (%22) bash not person to beryllium successful astir scenarios.

Examples of #:~:text=textStart,textEnd -------------------------------------- #:~:text=%22Homenum,Friends%20app%2E #:~:text="Homenum,Friends%20app. Links ----- https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=%22Homenum,Friends%20app%2E https://gadgethacks.com/how-to/potter-spells-0384951#:~:text="Homenum,Friends%20app.

For example, if you transcript a nexus beneath that ends successful a play (.), you tin paste it into Safari and get it to enactment conscionable fine. However, if you stock it via Messages, the app volition admit and abstracted the play arsenic portion of your message's text, removing it from the URL.

Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
#:~:text=textStart (left) | #:~:text=textStart,textEnd (right)

And the pursuing nexus highlights the full ninth spell, from the section's heading to the past portion of the past slug line.

Examples of #:~:text=textStart,textEnd -------------------------------------- #:~:text=9,action. #:~:text=9,action%2E Links ----- https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=9,action. https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=9,action%2E

Now, if I privation to nexus to the words "emergency contacts" successful the 14th spell alternatively of successful the 12th spell wherever they archetypal appear, I tin usage the prefix- and -suffix parts to leap implicit the archetypal lawsuit to the second. For that, the pursuing nexus does the trick.

Examples of #:~:text=prefix-,text,-suffix ----------------------------------------- #:~:text=chosen-,emergency%20contacts,-. #:~:text=chosen-,emergency%20contacts,-%2E Links ----- https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=chosen-,emergency%20contacts,-. https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=chosen-,emergency%20contacts,-%2E

Just using "chosen-" arsenic the prefix- without indicating a -suffix volition besides get america there.

Example of #:~:text=prefix-,text -------------------------------- #:~:text=chosen-,emergency%20contacts Link ---- https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=chosen-,emergency%20contacts
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
#:~:text=textStart,textEnd (left) | #:~:text=prefix-,text,-suffix oregon #:~:text=prefix-,text (right)

But skipping the -prefix and utilizing "." arsenic the -suffix volition instrumentality america to the 12th spell since it's the archetypal lawsuit wherever "emergency contacts" is followed by a period.

Examples of #:~:text=text,-suffix --------------------------------- #:~:text=emergency%20contacts,-. #:~:text=emergency%20contacts,-%2E Links ----- https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=emergency%20contacts,-. https://gadgethacks.com/how-to/potter-spells-0384951#:~:text=emergency%20contacts,-%2E

Text fragments besides enactment with regular site-coded fragments. So if the substance ever changes successful the substance fragment, it volition inactive constituent you to the conception with a matching "id" property connected the page. The links beneath instrumentality you straight to the ninth spell successful our usher connected Harry Potter spells for Siri and item the full archetypal paragraph beneath the heading.

Examples of #IDattribute:~:text=textStart ----------------------------------------- #jump-9heysirihomenumrevelio:~:text=%22Homenum,Friends%20app%2E #jump-9heysirihomenumrevelio:~:text=%22Homenum,Friends%20app. Links ----- https://gadgethacks.com/how-to/potter-spells-0384951#jump-9heysirihomenumrevelio:~:text=%22Homenum,Friends%20app%2E https://gadgethacks.com/how-to/potter-spells-0384951#jump-9heysirihomenumrevelio:~:text=%22Homenum,Friends%20app.
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
#:~:text=text,-suffix (left) | #IDattribute:~:text=textStart (right)

5. If Text Fragments Aren't Working for You

Safari has had a "Scroll to Text Fragment" experimental feature you could activate since iOS 15.4, but it was lone beneficial to developers until now. Before iOS 16.1, it was disabled by default, but present it's enabled by default.

If you went messing successful Safari's experimental WebKit features paper and accidentally turned disconnected "Scroll to Text Fragment," you tin toggle it backmost connected by going to Settings –> Safari –> Advanced –> Experimental Features –> Scroll to Text Fragment. Instead of toggling it on, you could besides scroll to the bottommost of the database and deed "Reset All to Defaults," besides disposable since iOS 15.4.

Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs

6. Formatting Text Fragments to Share

As you tin spot from the syntax above, formatting a substance snippet to beryllium highlighted is comparatively elemental if you're utilized to percent-encoding URLs. Otherwise, it's a spot analyzable to remember.

Unfortunately, determination isn't an casual mode to transcript a URL for a conception you privation to item successful Safari similar determination is successful Chrome. On Google Chrome for iOS, you tin item the text, past take "Create Link" from the contextual paper that appears. That enactment doesn't look successful Safari.

Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Creating a substance fragment nexus successful Chrome and sharing it with WhatsApp.

You tin effort highlighting substance successful Safari, past deed the stock button, but it doesn't bash thing peculiar with the URL, though it volition springiness it a affluent substance preview for Apple apps similar Messages, Mail, and Notes with the highlighted substance successful a punctuation block. Using "Share" from the contextual paper volition lone transcript the text.

A workaround until Apple implements an casual mode to transcript and stock substance fragments is to usage a shortcut. You tin effort the Share Text Fragments shortcut, which formats URLs utilizing the #:~:text=textStart encoding seen above. Any prefix-, -suffix, oregon textEnd you privation to add, you'll person to bash it manually for present until a amended shortcut comes along.

Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs
Safari's 16.1 Update for iPhone Includes a Hidden Feature Every Web Browser Needs

Keep Your Connection Secure Without a Monthly Bill. Get a lifetime subscription to VPN Unlimited for each your devices with a one-time acquisition from the caller Gadget Hacks Shop, and ticker Hulu oregon Netflix without determination restrictions, summation information erstwhile browsing connected nationalist networks, and more.

Buy Now (80% off) >

Other worthwhile deals to cheque out:

Cover photo, screenshots, and GIFs by Justin Meyers/Gadget Hacks
Read Entire Article