This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

window.open problem  RSS feed

 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have
a href='' on click='callfn'

in the callfn
i call window.open ,with _blank ie open in new window, based on some conditions.
It calls window.open correctly but it also puts the contents which are in this new window on the parent window which I dont want.
i.e it is opening new window with correct contents but also
submitting to the main window.

Would appreciate any inputs on how to get rid of the contents on parent window.

Thanks,
Gayatri
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onclick="fnc();return false;"

Eric
 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that works.
But I don't understand why I need to return false after the call.
Thanks,
Gayatri
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the link is doing its default behavior. If you return false, it cancels it from executing.

Eric
 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Eric
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!