MAMEWorld >> The Loony Bin
View all threads Index   Threaded Mode Threaded  

Pages: 1

Mr. DoAdministrator
MAME Art Editor
Reged: 09/21/03
Posts: 4876
Loc: California
Send PM


Neat... learned new HTML today... link to any text on a webpage
#397960 - 02/15/24 09:55 PM


You can link to specific text on a webpage, even if the page doesn't have an anchor in the page code for the text you want to link to.

Just add #:~:text= to the end of the normal link of the page

For example, this navigates directly to the artwork file for Mr. Do, and highlights it (and looks like I should update the CSS for highlighting for my site).

https://mrdo.mameworld.info/mame_artwork_ingame.php#:~:text=mrdo

This isn't so much for a page designer of the site in question... they would still use an anchor... this is more for someone that wants to link to something on another website that is not theirs, or for if you want to send a link to a friend, and direct them to a particular part of that page.

Note that for spaces, you have to add the "%20" in lieu of the space for phrases of words to work, like below link, will go to "Time Pilot"

https://mrdo.mameworld.info/mame_artwork_ingame.php#:~:text=Time%20Pilot

For complete specs... check link below. (And looks like I'm a bit behind... this feature was introduced 3.5 years ago).

https://web.dev/articles/text-fragments




RELAX and just have fun. Remember, it's all about the games.




cyberdman
MAME Fan
Reged: 03/04/06
Posts: 351
Send PM


Re: Neat... learned new HTML today... link to any text on a webpage new [Re: Mr. Do]
#397963 - 02/16/24 01:01 AM


Thanks. I always like learning new tricks like this for my own pages.



cyberdman



Robbbert
Sir
Reged: 08/21/04
Posts: 3204
Loc: A long way from you
Send PM


Re: Neat... learned new HTML today... link to any text on a webpage new [Re: Mr. Do]
#397964 - 02/16/24 05:44 AM


> You can link to specific text on a webpage, even if the page doesn't have an anchor
> in the page code for the text you want to link to.
>
> Just add #:~:text= to the end of the normal link of the page
>
> https://web.dev/articles/text-fragments

Only for Chrome and Edge. Doesn't work with Firefox.



Mr. DoAdministrator
MAME Art Editor
Reged: 09/21/03
Posts: 4876
Loc: California
Send PM


Re: Neat... learned new HTML today... link to any text on a webpage new [Re: Robbbert]
#397965 - 02/16/24 11:39 AM


> > You can link to specific text on a webpage, even if the page doesn't have an anchor
> > in the page code for the text you want to link to.
> >
> > Just add #:~:text= to the end of the normal link of the page
> >
> > https://web.dev/articles/text-fragments
>
> Only for Chrome and Edge. Doesn't work with Firefox.


Hmm... that's odd... 'cause it's also referenced on Mozilla.org

https://developer.mozilla.org/en-US/docs/Web/Text_fragments




RELAX and just have fun. Remember, it's all about the games.




Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4465
Loc: Melbourne, Australia
Send PM


Don’t use Chrome-only features new [Re: Mr. Do]
#397970 - 02/16/24 03:54 PM


That’s a Chrome feature, not part of any standard (draft here, not accepted by any standards body), and doesn’t work in Firefox or Safari. Please don’t rely on non-standard Chrome features. It’s getting to the point where web sites relying on Chrome features that don’t work in other browsers are as bad as IE6-dependent sites used to be. Help keep the web open by adhering to standards and supporting multiple browsers. Don’t give Google de facto control of the web.



Mr. DoAdministrator
MAME Art Editor
Reged: 09/21/03
Posts: 4876
Loc: California
Send PM


Wasn't planning to... new [Re: Vas Crabb]
#397976 - 02/16/24 08:55 PM


> That’s a Chrome feature, not part of any standard (draft here, not accepted by any
> standards body), and doesn’t work in Firefox or Safari. Please don’t rely on
> non-standard Chrome features. It’s getting to the point where web sites relying on
> Chrome features that don’t work in other browsers are as bad as IE6-dependent sites
> used to be. Help keep the web open by adhering to standards and supporting multiple
> browsers. Don’t give Google de facto control of the web.

Don't worry... I didn't have any plans for that on my site or anything... just thought it was cool, for example to share a link to someone else, to direct them to a specific area of a longer page.

I guess you didn't see my reply to Robbbert below... I thought it was a thing, because the first link I found for it was on Mozilla's Developer site:

https://developer.mozilla.org/en-US/docs/Web/Text_fragments

(I just hadn't scrolled all the way down the page to check browser compatibility).


I'm actually very adamant on my end, that everything pass W3C checks.

[And of course, as I write that, I go check, and I've got a bunch of little errors that need fixing 😓]

[Updates are coming... promise... I know it's been 3+ years... no one is more upset about that than I am]




RELAX and just have fun. Remember, it's all about the games.




cyberdman
MAME Fan
Reged: 03/04/06
Posts: 351
Send PM


Re: Neat... learned new HTML today... link to any text on a webpage new [Re: Robbbert]
#397987 - 02/17/24 04:42 PM


Bummer. Oh well nice idea in theory.



cyberdman


Pages: 1

MAMEWorld >> The Loony Bin
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  GatKong 
0 registered and 157 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 223