+ 1

Anchor with href # open in new page

I have problem with my code I have <a href="#PS3" >go</a> it must go to div with ID PS3 but instead it opened home page in new page, someone referred that base url tag in head is responsible for this behavior, how can I override this without removing base tag?

31st Mar 2018, 8:33 PM
Osama Hasan
Osama Hasan - avatar
3 Respostas
+ 1
If you have a <base> tag in <head> with another url than the related/actual page (with the element with id 'PS3'), you need to provide its absolute url with '#PS3' append to it, rather than let the browser rebuild the relative url '#PS3' based on the <base> href value, and provide an explicit 'target="_self"' attribute if the <base> tag define another one ^^
31st Mar 2018, 9:02 PM
visph
visph - avatar
+ 2
did you try to use target="_self" in the "a" tag?
31st Mar 2018, 9:00 PM
Damyan Petkov
Damyan Petkov - avatar