DEV Community

Indian Train
Indian Train

Posted on

Angular - Webpage redirect to homepage when opening external URL

Whenever I open an external URL from my webpage, this webpage redirect to homepage. The external URL gets open in new tab but the webpage from which I am opening the external URL it redirect to homepage. I don't know why this is happening I tried all the possible but couldn't get rid of it.

xyz.html

<a (click)="goToLink('https://www.example.com/abc')">page link</a>

xyz.ts

goToLink(url: string) {
  window.open(url, "_blank");
}
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
indiantrain profile image
Indian Train

There is also not found rule in my website. If any URL which is not from the website it will redirect to not found page. You can have a look on my website indiantrain.in/, and let me know the correct way for adding external link.