← Desenvolvimento

[JavaScript] Abrir em nova tab...

Lida 4829 vezes

Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Boas, tenho este codigo:

Código: [Seleccione]
javascript:location.href='http://www.site.xxx?link='+encodeURIComponent(location.href)

E queria que ao clicar, ele abrisse numa nova tab...
Offline

jpgmn 
Membro
Mensagens 305 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Código: [Seleccione]

javascript:window.open('http://www.site.xxx?link='+encodeURIComponent(location.href))


Vai-te abrir numa nova janela (só abre numa nova tab se tiveres o browser configurado para abrir novas janelas em tabs).

Abraços,
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Citação de: "jpgmn"
Código: [Seleccione]

javascript:window.open('http://www.site.xxx?link='+encodeURIComponent(location.href))


Vai-te abrir numa nova janela (só abre numa nova tab se tiveres o browser configurado para abrir novas janelas em tabs).

Abraços,


Não funciona...
Isso é para por no Firefox como estes butões do sapo tags > http://tags.sapo.pt/buttons
Offline

jpgmn 
Membro
Mensagens 305 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Funcionar, funciona... o que se passa é que na tab onde estás quando carregas no botão aparece [object] qq coisa, certo?

Experimenta:

Código: [Seleccione]

javascript:window.open('http://www.site.xxx?link='+encodeURIComponent(location.href));history.go(0);


É um bocadito martelado :D
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Nada...

O que eu quero é mais ou menos isto:

Código: [Seleccione]
javascript:window.open('http://www.domelhor.net/submit.php?url='+encodeuricomponent(location.href));history.go(0);

Que é para eu submeter artigos no domelhor.net mais rapidamente...
Mas quero que abra o domelhor.net numa página aparte...
Offline

jpgmn 
Membro
Mensagens 305 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

OK, got the problem :)

Experimenta pôr:

Código: [Seleccione]

javascript:window.open('http://www.domelhor.net/submit.php?url='+encodeURIComponent(location.href));history.go(0);


O javascript é Case Sensitive :)

Abraços,
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

tanks...
 :D
Offline

jpgmn 
Membro
Mensagens 305 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

lol!

Se vires nos primeiros posts estava bem! :)
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

:shock:  :shock:  :shock:  :shock:

lol

Por acaso...