Search code examples
javascripthtmlfirefoxbrowserwindow.open

In firefox browser, Window.open strangely displaying [object Window] after clicking


I have set anchor link so that on click it will open link into new window.

I have used below code to open new link into new window.

<a href="javascript:window.open('https://www.remax.fi/fi/kiinteistonvalitys/tietosuojaseloste/', 'newwindow', 'fullscreen=1')">"tietosuojaselosteeseen"</a>

url : https://www.remax.fi/fi/

On above url page, in bottom there been contact form on which I have set anchor link in text tietosuojaselosteeseen.

In chrome browser it working properly but In firefox browser it display error page which show [object Window] text.

Please find screenshot for further clarification.

I have tried much to find solution of this problem but not able to figure out this.

Please help me if any one have idea regarding it.

enter image description here enter image description here


Solution

  • I think you can just use onlick event for this. You can modify your code like this

    <a href="javascript:;" onclick="window.open('https://www.remax.fi/fi/kiinteistonvalitys/tietosuojaseloste/', 'newwindow', 'fullscreen=1');return false;">"tietosuojaselosteeseen"</a>
    

    Here, on href it will execute like javascript:void(0); and we call the window.open on click event. Also return false if there are other events triggers with it.