Bei Click Neuen Tab Fenster öffnen

Logo

Mitglied
Hallo ich habe hier ein Javascript für Bookmarks. Problem ist das ich es machen kann wie ich will mit target="_blank" oder onclick = window.open bei Click auf das jeweilige Icon wird einfach kein neues Tab oder Fenster geöffnet.
Wie muss das Script aussehen das es in neuen Fenster öffnet?

Java:
var imgpath = "/bookmarkscript/gfx/";//ADD trailing slash
var sburl = encodeURIComponent(location.href);
var sbtitle = encodeURIComponent(document.title);

 {
	var txtsite = "Diese Seite bei";
	var txtenter = " bookmarken.";
	
	var facebook_com = "location.href='http://de.facebook.com/sharer.php?u='+sburl+'&t='+sbtitle;return false";
	var myspace_com = "location.href='http://www.myspace.com/index.cfm?fuseaction=postto&u='+sburl+'&t='+sbtitle;return false";
	var misterwong_de = "location.href='http://www.mister-wong.de/index.php?action=addurl&bm_url='+sburl+'&bm_description='+sbtitle;return false";
	var delicio_us = "location.href='http://del.icio.us/post?v=2&url='+sburl+'&title='+sbtitle;return false";
	var google_com = "location.href='http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+sburl+'&title='+sbtitle;return false";
	var stumbleupon_com = "location.href='http://www.stumbleupon.com/submit?url='+sburl+'&title='+sbtitle;return false";
	var yahoo_com = "location.href='http://de.myweb2.search.yahoo.com/myresults/bookmarklet?t='+sbtitle+'&u='+sburl;return false";
	var yigg_de = "location.href='http://yigg.de/neu?exturl='+sburl;return false";
	var alltagz_de = "location.href='http://www.alltagz.de/bookmarks/?action=add&address='+sburl+'&title='+sbtitle;return false";	
	var oneview_de = "location.href= 'http://www.oneview.de/quickadd/neu/addBookmark.jsf?URL=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title);return false";
	var seekxl = "location.href= 'http://social-bookmarking.seekxl.de/neu/?add_url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title);return false";
	var favoriten = "location.href= 'http://www.favoriten.de/url-hinzufuegen.html?bm_url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title);return false";

	document.write('<a href="http://de.facebook.com/" rel="nofollow" onClick="' + facebook_com +'" title="' + txtsite +' facebook.com' + txtenter +'"><img src="' + imgpath +'facebook.gif" alt="' + txtsite +' facebook.com' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://www.myspace.com/" rel="nofollow" onClick="' + myspace_com +'" title="' + txtsite +' [url=http://www.myspace.com]MySpace: Musik, Videos, Games und mehr[/url]' + txtenter +'"><img src="' + imgpath +'myspace.gif" alt="' + txtsite +' myspace.com' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://www.mister-wong.de/" rel="nofollow" onClick="' + misterwong_de +'" title="' + txtsite +' [url=http://www.mister-wong.de]Mister Wong | Social Bookmarking Tool[/url]' + txtenter +'"><img src="' + imgpath +'misterwong.gif" alt="' + txtsite +' Mister Wong' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://del.icio.us/" rel="nofollow" onClick="' + delicio_us +'" title="' + txtsite +' del.ico.us' + txtenter +'"><img src="' + imgpath +'delicio.gif" alt="' + txtsite +' del.ico.us' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://www.google.com/" rel="nofollow" onClick="' + google_com +'" title="' + txtsite +' google.com' + txtenter +'"><img src="' + imgpath +'google.gif" alt="' + txtsite +' google.com' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://www.stumbleupon.com/" rel="nofollow" onClick="' + stumbleupon_com +'" title="' + txtsite +' stumbleupon.com' + txtenter +'"><img src="' + imgpath +'stumbleupon.gif" alt="' + txtsite +' stumbleupon.com' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://de.myweb2.search.yahoo.com/" rel="nofollow" onClick="' + yahoo_com +'" title="' + txtsite +' yahoo.com' + txtenter +'"><img src="' + imgpath +'yahoo.gif" alt="' + txtsite +' yahoo.com' + txtenter +'" border="0"></a> ')            	
	document.write('<a href="http://yigg.de/" rel="nofollow" onClick="' + yigg_de +'" title="' + txtsite +' yigg.de' + txtenter +'"><img src="' + imgpath +'yigg.gif" alt="' + txtsite +' yigg.de' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://www.alltagz.de/" rel="nofollow" onClick="' + alltagz_de +'" title="' + txtsite +' alltagz.de' + txtenter +'"><img src="' + imgpath +'alltagz.gif" alt="' + txtsite +' alltagz.de' + txtenter +'" border="0"></a> ')
	document.write('<a href="http://oneview.de/" rel="nofollow" onClick="' + oneview_de +'" title="' + txtsite +' oneview.de' + txtenter +'"><img src="' + imgpath +'oneview.gif" alt="' + txtsite +' oneview.de' + txtenter +'" border="0"></a> ') 	
	document.write('<a href="http://social-bookmarking.seekxl.de" rel="nofollow" onClick="' + seekxl +'" title="' + txtsite +' seekxl.de' + txtenter +'"><img src="' + imgpath +'seekxl.gif" alt="' + txtsite +' seekxl.de' + txtenter +'" border="0"></a> ') 
	document.write('<a href="http://www.favoriten.de" rel="nofollow" onClick="' + favoriten +'" title="' + txtsite +' favoriten.de' + txtenter +'"><img src="' + imgpath +'favoriten.gif" alt="' + txtsite +' favoriten.de' + txtenter +'" border="0"></a> ')
}

In der Theorie ist es so einfach aber irgendwie mach ich es nicht richtig!
 
1. falsches Forum, da es Javascript ist
2. mit
Code:
location.href
greifst du auf das aktuell angezeigte Fenster zu.

warum setzt du den Link nicht bei a href ein, so wie vorgesehen?
 
Zuletzt bearbeitet:
Code:
 var facebook_com = 'http://de.facebook.com/sharer.php?u='+sburl+'&t='+sbtitle;
document.write('<a href="'+facebook_com+'" onClick="window.open(this.href);return false;" title="' + txtsite +' facebook.com' + txtenter +'"><img src="' + imgpath +'facebook.gif" alt="' + txtsite +' facebook.com' + txtenter +'" border="0"></a> ')

so in etwa.
P.S.
Code:
rel="nofollow"
ist meiner Meinung nach Quatsch. Zumindestmal ist es wohl keine Standart-Beziehung.
 
ja so gehts aber wenn man nun über die den link fährt dann wird die komplette url angezeigt und nicht nur facebook.com . also Anmelden | Facebook .

Wenn es die url nicht gibt dann erzeuge ich 1000ende neue urls. einfacher wäre es wenn es einfach nur facebook.com wäre in meinen broswer und es übergeben würde in einem neuen fenster wäre es besser.
 
habe gerade gesehen das spiegel.de auch die url anzeigt.
ich sag einfach mal das die seo´s von spiegel.de wissen was sie da tun. 😀

da der code von dir funtz werde ich den so lassen ausser du gibst nochmal ein codeschnipsel wie ich es umbauen müsste.

Ansonsten hier für die die den Bookmarscript nutzen möchten mal der gesamte Code um Bookmarks in neuem Fenster zu erzeugen.

Java:
var imgpath = "/bookmarkscript/gfx/";//ADD trailing slash
var sburl = encodeURIComponent(location.href);
var sbtitle = encodeURIComponent(document.title);

 {
	var txtsite = "Diese Seite bei";
	var txtenter = " bookmarken.";
	
	var facebook_com = 'http://de.facebook.com/sharer.php?u='+sburl+'&t='+sbtitle;
	var myspace_com = 'http://www.myspace.com/index.cfm?fuseaction=postto&amp;u='+sburl+'&t='+sbtitle;
	var misterwong_de = 'http://www.mister-wong.de/index.php?action=addurl&amp;bm_url='+sburl+'&amp;bm_description='+sbtitle;
	var delicio_us = 'http://del.icio.us/post?v=2&url='+sburl+'&title='+sbtitle;
	var google_com = 'http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+sburl+'&title='+sbtitle;
	var stumbleupon_com = 'http://www.stumbleupon.com/submit?url='+sburl+'&title='+sbtitle;
	var yahoo_com = 'http://de.myweb2.search.yahoo.com/myresults/bookmarklet?t='+sbtitle+'&u='+sburl;
	var yigg_de = 'http://yigg.de/neu?exturl='+sburl;
	var alltagz_de = 'http://www.alltagz.de/bookmarks/?action=add&address='+sburl+'&title='+sbtitle;
	var oneview_de = 'http://www.oneview.de/quickadd/neu/addBookmark.jsf?URL=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title);
	var seekxl = 'http://social-bookmarking.seekxl.de/neu/?add_url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title);
	var favoriten = 'http://www.favoriten.de/url-hinzufuegen.html?bm_url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title);
	
  document.write('<a href="'+facebook_com+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' facebook.com' + txtenter +'"><img src="' + imgpath +'facebook.gif" alt="' + txtsite +' facebook.com' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+myspace_com+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' [url=http://www.myspace.com]MySpace: Musik, Videos, Games und mehr[/url]' + txtenter +'"><img src="' + imgpath +'myspace.gif" alt="' + txtsite +' myspace.com' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+misterwong_de+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' [url=http://www.mister-wong.de]Mister Wong | Social Bookmarking Tool[/url]' + txtenter +'"><img src="' + imgpath +'misterwong.gif" alt="' + txtsite +' Mister Wong' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+delicio_us+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' del.ico.us' + txtenter +'"><img src="' + imgpath +'delicio.gif" alt="' + txtsite +' del.ico.us' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+google_com+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' google.com' + txtenter +'"><img src="' + imgpath +'google.gif" alt="' + txtsite +' google.com' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+stumbleupon_com+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' stumbleupon.com' + txtenter +'"><img src="' + imgpath +'stumbleupon.gif" alt="' + txtsite +' stumbleupon.com' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+yahoo_com+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' yahoo.com' + txtenter +'"><img src="' + imgpath +'yahoo.gif" alt="' + txtsite +' yahoo.com' + txtenter +'" border="0"></a> ')            	
  document.write('<a href="'+yigg_de+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' yigg.de' + txtenter +'"><img src="' + imgpath +'yigg.gif" alt="' + txtsite +' yigg.de' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+alltagz_de+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' alltagz.de' + txtenter +'"><img src="' + imgpath +'alltagz.gif" alt="' + txtsite +' alltagz.de' + txtenter +'" border="0"></a> ')
  document.write('<a href="'+oneview_de+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' oneview.de' + txtenter +'"><img src="' + imgpath +'oneview.gif" alt="' + txtsite +' oneview.de' + txtenter +'" border="0"></a> ') 	
  document.write('<a href="'+seekxl+'"  rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' seekxl.de' + txtenter +'"><img src="' + imgpath +'seekxl.gif" alt="' + txtsite +' seekxl.de' + txtenter +'" border="0"></a> ') 
	document.write('<a href="'+favoriten+'" rel="nofollow" onClick="window.open(this.href);return false;" title="' + txtsite +' favoriten.de' + txtenter +'"><img src="' + imgpath +'favoriten.gif" alt="' + txtsite +' favoriten.de' + txtenter +'" border="0"></a> ')
  }

Danke für die Hilfe :toll:
 
seo?
Ich wüsste nicht warum es schlecht sein soll, wenn der Benutzer sieht, was der Link macht.
Ansonsten könntest du natürlich das mit einem Array machen, dann ist es auch nicht so redundant
 
ich denke es ist so in ordnung wie du es jetzt ist. seiten wie bild.de und spiegel.de machen es auch so und ich sag mal so wenn deren seo´s es so machen kann ich es wohl auch! Denke die sind einfach involvierter in der sache als ich! 😉

Danke für die Hilfe! :toll:
 

Zurück
Oben