Home > Net >  Why the url of youtube will be changed when I hover mouse on a video?
Why the url of youtube will be changed when I hover mouse on a video?

Time:02-08

I was surfing on youtube and I realized something.
When I hover mouse on a video, then the url will be changed.

enter image description here

Interestingly, this happens in some browsers.
What's the matter?
Why does string start with &? https://www.youtube.com/?&ab_channel=NASA
What is the benefit to change the URL?

CodePudding user response:

Interestingly, this happens in some browsers.

Different browser different support, a what you see is what you get is a standard we all want and must write our scripts specific to each browser if a feature requires it. In this case the new feature may not be widely supported or their coding wasn't compliant enough to give you this exact result each browser.

What's the matter?

No problem here, the URL is a tiny-bit broken but won't impact site performance unless you happen to error out the server and crash the entire network.

Why does string start with ?& https://www.youtube.com/?&ab_channel=NASA What is the benefit to change the URL?

A URL alone has no parameters passed to it, so youtube.com. When a parameter is passed through the site on its HTTPS request will check these and determine what it is you want. So the response will return NASA cause ab_channel included it.

Because ? has nothing after it like ?video=asd89sa982 it's treated as undefined and serves no value or importance.

YouTube can fix it if they desire with script adjustment.

CodePudding user response:

the URLs works in a way that when the site has started or reloaded, It's going to check for any element that has a href which has a link that has either https://www.youtube.com/watch?v= or https://youtu.be/ basically a YouTube video and then save those links, when one of them i hovered over, It's tell which. This works fine but one downside that I'm currently facing is that new links that are added in after the site has already started or reloaded won't be counted and therefore when I hover them it won't show the links, I'm reffering to comments; for-example if I make a comment that has a link to a video, after i post that comments and hover over that link I posted, It won't show the link. I could make a function which reloads every like 5 seconds but this doesn't seem to be a good idea. Plus what I'm actually working on, realoding every time won't be good.

  •  Tags:  
  • Related