Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 607
Moon Avatar asked Oct 29 '25 07:10

Moon


1 Answers

When you put the Javascript in the href, the page also navigates to whatever the Javascript returns. In this case window.open returns a copy of the window object, which can't be navigated to.

You can solve this by moving the Javascript to onclick and having a href="#", or you can add a ;return false after the window.open, or put void() around the window.open,

like image 53
Amunium Avatar answered Oct 31 '25 12:10

Amunium