Is there any way where I can replace the hostname in url but I do not want the browser to load/redirect/open the replaced hostname, it should just show it above in address bar nothing to do with it.
Scenario:
I am testing a website (legally) where I found that it is just checking the top.location.hostname in URL and if it is equal to self.location.hostname then it behaves normally else it throws the alert which is why I am guessing there could be a possibility of clickjacking if I can replace the hostname in address bar
If it can be done through JS then its awesome, i can load the my script of changing the name before the iframe domain hits it
Double-framing was one of the first attacks against frame-busting JavaScript. This is always very subjective to the exact code used, but you should check here if any attacks are relevant.
https://owasp.org/www-pdf-archive//OWASP_AppSec_Research_2010_Busting_Frame_Busting_by_Rydstedt.pdf
If this is a professional engagement, I would raise the issue regardless of whether or not you can produce a bypass of the frame-buster. X-Frame-Options is the strongest Clickjacking mitigation, and would never rely on JavaScript to do so.