this post was submitted on 01 Aug 2024
477 points (99.2% liked)
Technology
59374 readers
3671 users here now
This is a most excellent place for technology news and articles.
Our Rules
- Follow the lemmy.world rules.
- Only tech related content.
- Be excellent to each another!
- Mod approved content bots can post up to 10 articles per day.
- Threads asking for personal tech support may be deleted.
- Politics threads may be removed.
- No memes allowed as posts, OK to post as comments.
- Only approved bots from the list below, to ask if your bot can be added please contact us.
- Check for duplicates before posting, duplicates may be removed
Approved Bots
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm confused, does this mean that an ad can show the URL "google.com" even though clicking on it will take you to a different URL? Why doesn't Google just make it so that the ad shows the actual URL that the ad links to?
That's actually pretty simple to do. I don't know if this is how they did it, but one way is just creating an tag with the href to google.com. that'll show the destination if you hover over it. Then you just add an event listener to the click event, prevent the default event from executing, and manually redirect somewhere else.
Made a quick example: https://codepen.io/Ghoelian/pen/poXeOyo
Yes, but ads shouldn't have that level of control. They should provide an image or video and a link.
Oh absolutely. I kinda feel like preventing the default action on a tag like that should just not be allowed, or browsers should not display the target link thing if it has an event listener attached or something.