Prevent Target=”” Attribute from Opening a New Window

Occasionally, when working with javascript toggles it becomes necessary to use methods like target=”<?php echo $counter; ?>” in order to build a relationship with other elements involved.

This can cause conflicts in other browsers the deeper into compatibility testing you go.

This source touches on both methods to use. Newer browsers:

href="javascript:void(this.onclick=function(){return false;})"

Internet Explorer:

onclick="return false;"


Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.