How to use js to determine whether the current page is a specified link, and whether the user is on the PC side or the mobile side to jump to a different home page?

I have read the website and many of the answers are only to jump on the PC side and the mobile side. But I want to put this js in the head, in that case, every time I visit another page, I will perform the js jump back to the home page, so it won"t achieve the effect I want. What I want is to judge whether the current page is xxx.html first? If yes, continue to determine the PC side and the mobile side to jump to different home pages, if not, do not execute. Could you tell me how to write this js?

Mar.01,2021

can't you just put the judgment logic in xxx.html ? The rest of html will not execute this logic


what I want is to determine whether the current page is xxx.html first?

like this?

if(location.href == xxx.html){
    //xxx.html
} else {

}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1beaa77-31198.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1beaa77-31198.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?