target _blank question

titanium

Free Member
Mar 30, 2013
243
31
53
I have the following code for a widget:

<form action="http://dictionary.cambridge.org/sea...widget_searchbox&utm_campaign=widget_tracking" method="post"><table style="font-size: 10px; border: 1px solid black; background: #242C72 url('http://dictionary.cambridge.org/external/images/sbr.gif?version=2014-12-17-0914') no-repeat top right;" width="150px" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td colspan="2"><a href="http://dictionary.cambridge.org/" style="display:block; background: transparent url('http://dictionary.cambridge.org/external/images/sbl.gif?version=2014-12-17-0914') no-repeat 5px 6px; height: 32px;"></a></td></tr><tr><td width="68px" style="padding: 4px;"><input name="q" size="8" style="display:block; height: 100%;width: 100%; font-size:10px " type="text"/></td><td width="50px" style="padding: 0 4px 0 0;"><input width="100%" style="display:block; float: right; background: #92AE2E url('http://dictionary.cambridge.org/external/images/sbb.gif?version=2014-12-17-0914') repeat-x; border: 1px solid green; font-size:10px; padding: 2px 0;" type="submit" border="0" value="Look it up"/></td></tr></tbody></table></form>

I want the browser to open in a new tab but I can't figure out where to put the target _blank bit.
Thanks!
 
Cool, so between change:

a href

to:

a target="_blank" href

that should do it.

Regards,

Jacob
 
Upvote 0
thanks, but it still opens up in the same tab. Is it possible that cambridge.org have control over how it opens?
 
Upvote 0
Works fine for me.

What doesn't open in the new tab is the 'Look it up'. Add the target="_blank" to the form action to fix this.
 
Upvote 0
Yep, as fisicx says, you need to add it on the form action, not the hyperlink.

Regards,

Jacob
 
Upvote 0
Excellent! Thanks very much. Sorry I didn't explain it well - it didn't occur to me that anyone would click without looking up a word!
 
Upvote 0
I should point out that target="_blank" may open in the new window OR new tab depending on how the viewers browser in configured. I'm pretty sure you can't control this.

That doesn't matter - it'll be going on articles written for students of English who might want to look up the meaning of words. If it opens in the same tab it will disturb their reading of the lesson. Thanks though!
 
Upvote 0

Latest Articles