Search code examples
angularhrefmicrosoft-edge

Microsoft Edge adds href link when there is no href on the element


So, I have an angular 2 application that changes pages using button elements that have (click) functions that process stuff, emit data and load different components. This all works fine and dandy on Chrome and Firefox, but on Edge the button suddenly has a path pointing to my application location and after loading the correct component, it reloads to the app homepage.

I have included two screenshots showing the situation where the mouse is hovering over the button where you can see the path being shown in the edge (WRONG), and no path (RIGHT) in Chrome and Firefox

Screen1: EdgeEdge Issue

Screen2: Firefox/Chromeenter image description here

Why does Edge add non existing href links? And how can I remove or block them?


Solution

  • Ugh, having a button with no type="button" is considered a submit by default on IE/EDGE and it adds the location href automatically.

    Adding type="button" on all of my buttons fixed the issue.