views:

76

answers:

4

When you put this in your browser it opens a simple notepad to type in.

I don't know enough about javascript to alter it but I would like to make it so it DOESN'T open in a new window but rather in the current window or another tab.

Is this even possible?

javascript:pwin=window.open('','_blank','menubar=yes,scrollbars=yes,location=no,height=450,width=350');pwin.document.body.contentEditable='true';pwin.document.designMode='on';void(0);if(window.focus){pwin.focus()};
A: 

Window.open always opens this in a new window. Instead I think you can try window.location. Not tried tough.

Sachin Shanbhag
+2  A: 

Technically, window.open does not always open in a new window. You can use _self instead of _blank, and it will open in the same window. Or use _parent and it will open in the current frame's parent.

DOK
A: 

Ok did a little digging and there is nothing you can do that will guarantee that it will open in a new tab. However if you remove the width and height parameters some browsers will open in a new tab if user preferences haven't overridden this behavior. See this post (2nd answer in list) Stackoverflow post

antonlavey
A: 

If you aren't looking to open a window, then don't window.open()

Setting window.location should do the trick, as pointed out by Sachin

Montagist