Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where do I insert target='_blank'

Status
Not open for further replies.

ghoulardi

ISP
Mar 16, 2004
11
US
Im working on a toolbar for IE. It has a button
you can use to open a selected (highlighted) non active url.
It opens the link in the same window.

It works fine but I want the link to open in a new window.

I just cannot figure out where to insert target='_blank'

here is the line I need to insert it to.

"javascript:q=(document.frames.length?'':document.selection.createRange().text);for(i=0;i<document.frames.length;i++){q=document.frames.document.selection.createRange().text;if(q!='')break;}if(q=='')void(alert('Nothing was selected. Please select an URL on the page. '));if(q!=''){if(q.substr(0,7)!=\"

Can someone Please help me???
Thank you very much!
 
Typically you would put target="_blank" in the <a href> HTML link:

Code:
<a href="" target="blank">

Maybe for the solution you are working on you need to look into using window.open. Do a search (in this forum or on google etc) for window.open for references to it's use (it's been covered here a lot).

Jeff
 
Thanks alot. I just wish someone knew exactly how It should go. hehe, Ive been searching for awhile on google and here but I will continue looking. Thnks again for the info.
 
I haven't got a way to test this, and I'm not certain if this is what you want (for all 3 possibilities according to the code), but try this suggestion:

Code:
"javascript:q=(document.frames.length?'':document.selection.createRange().text);for(i=0;i<document.frames.length;i++){q=document.frames.document.selection.createRange().text;if(q!='')break;}if(q=='')void(alert('Nothing was selected. Please select an URL on the page. '));if(q!=''){if(q.substr(0,7)!=\"[URL unfurl="true"]http://\"){myWin=window.open('http://'+q,'myWindow','');return[/URL] false;}else{myWin=window.open(q,'myWindow','');return false;}myWin=window.open(q,'myWindow','');return false;}}"

I've modified near the end of the string to use window.open (which ought to open things in a new window for you).

Please let me know how you go!
Jeff
 
Thanks alot for taking the time to try and help me with this. It didnt work unfortunatley, but I have atleast got an idea of what it should look like. As you can probably tell I know very little about javascript.
If your interested in testing a little, the link for the toolbar is below. If not its still a pretty cool alternative for the google toolbar. You can tottaly custumize it and add your own search engines.
Im using a resource editor called Resource hacker. The javascript line is located under string 8, line 113 in the ultrabar.dll file.



Thank you very much again, for your help.
 
You might be interested in my faq ... faq216-4345

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top