Can you create a Bookmark without the id attribute?

Asked

Viewed 90 times

-1

Well, I have this doubt because I have read several articles from certain websites and many of the authors do not place the attribute id in the elements what ends up happening is that if you find sections and want to create Bookmarks on your page referencing to these sections of the site has no way, many of the sites use more classes.

As, for example, below when clicking the link the current page will be directed to a page of MDN on the API Geolocation and the page will jump to a certain section (thanks to the attribute id):

<a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API/#Concepts_and_usage" target="_blank">Geolocation API</a>

Okay, but what if there was no attribute id as on many sites and yes an attribute class, an element without attribute and etc, would have to jump through the sections of the site to create the Bookmark, without the attribute id or not?

  • With Js it would be possible, but there is no Pq, the internal anchor is something old and well accepted...

  • @hugocsl, it’s not that friend! the issue is on sites that do not use the attribute id (in case not my and yes third party) as I would for the link (from my site) skip to certain sections (from third party site) without the attribute id.

1 answer

0

Answer taken from the stack overflow in English, to see the rest of it just click on the link below:

https://stackoverflow.com/a/52215052/12096355

You can’t

The elements on an external page are not accessible. The `Id 'tags may seem accessible, as you may have a public URL that scrolls to them, but this is a browser implementation. No other element can be accessed like this. Since non-identification elements are not accessible, you cannot tell the browser that you want to scroll to them. You can’t even tell the browser that you want to scroll a fixed distance on an external page; there’s simply no way to do it in HTML or Javascript.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.