Autore Topic: problemi window.name con FF1.5  (Letto 1316 volte)

0 Utenti e 2 Visitatori stanno visualizzando questo topic.

Offline robertoroberto

  • Post: 7
problemi window.name con FF1.5
« il: 01 Febbraio 2006 09:16:21 »
Ho una pagina con un iperlink fatto come segue:
Codice: [Seleziona]
<a href="mypage.html" target="xxx">Click here</a>
L'utente quindi puo clicclare sull'iperlink e aprire la pagina "mypage.html".
Ovviamente l'utente e' libero di aprirla cliccando direttamente o usare il tasto destro del mouse e decidere di aprirla in una nuova window o tab.

Nella pagine mypage.html ho del codice js che cerca di recuperare il nome della window (window.name), peccato che con FF il nome corretto ("xxx", ossia quello impostato come target) viene restituito solo se NON uso il tasto destro open in new window. Ovviamente con IE il risultato e' sempre quello voluto.

Non so se e' da considerarsi un bug o un comportamento corretto.. fatto sta che io ho necessita' di recuperare l'eventuale nome della window ossia del target del link.
Potrei immaginare un workaround di passare come parametro al'url il target ("xxx") nel mio caso e poi risettarlo.. ma mi sembra un po bruttino.. spero proprio che sia un bug e che verra' risolto..

Ci sono eventualmente altri modi per recuperarlo ? anche se con del codice FF dependent....

grazie a tutti
Ciao
Roberto

Offline flod

  • Amministratore
  • Post: 15057
    • http://www.flod.org
Re: problemi window.name con FF1.5
« Risposta #1 il: 01 Febbraio 2006 09:19:07 »
Intanto sposto in Evangelizzazione.

Una cosa non mi chi è chiara: a cosa ti serve recuperare il nome della window?

Offline klades

  • Moderatore
  • Post: 5788
    • http://www.nic-nac-project.org/~kaosmos
Re: problemi window.name con FF1.5
« Risposta #2 il: 01 Febbraio 2006 10:41:04 »
Con Firefox/Mozilla quando tu apri una pagina con il tasto destro --> "apri in nuova finestra" , l'attributo TARGET viene sovrascritto con il valore "_blank".
E' un comportamento corretto dato che secondo le prescrizioni del w3c,

Citazione
User agents may provide users with a mechanism to override the target attribute.

Se per il tuo scopo devi per forza usare il nome della finestra, penso che tu debba usare la funzione window.open sul link.
Ciao, Paolo

Offline robertoroberto

  • Post: 7
Re: problemi window.name con FF1.5
« Risposta #3 il: 01 Febbraio 2006 11:09:41 »
Scusate se aveo postato nella sezione sbagliata.
Cmq a me serviva per capire se alla fine dovevo chiudere la window o tornare da altre parti.

Ma se le specifiche dicono come ha scritto klades... non c'e modo (se non quello suggerito

Offline klades

  • Moderatore
  • Post: 5788
    • http://www.nic-nac-project.org/~kaosmos
Re: problemi window.name con FF1.5
« Risposta #4 il: 01 Febbraio 2006 11:26:36 »
Tanto per completezza, la frase citata è tratta da qui:
http://www.w3.org/TR/REC-html40/present/frames.html#h-16.3.2

Offline robertoroberto

  • Post: 7
Re: problemi window.name con FF1.5
« Risposta #5 il: 01 Febbraio 2006 12:04:41 »
Beh leggendo quel riferimento che hai segnalato pero si potrebbe interpretare il tutto a mio favore  :lol:

Nel senso che si legge:
Codice: [Seleziona]
User agents should determine the target frame in which to load a linked resource according to the following precedences (highest priority to lowest):
[list]
[li]If an element has its target attribute set to a known frame, when the element is activated (i.e., a link is followed or a form is processed), the resource designated by the element should be loaded into the target frame.[/li]
 
[li]If an element does not have the target attribute set but the BASE element does, the BASE element's target attribute determines the frame. [/li]

[li]If neither the element nor the BASE element refers to a target, the resource designated by the element should be loaded into the frame containing the element. [/li]

[li]If any target attribute refers to an unknown frame F, the user agent should create a new window and frame, assign the name F to the frame, and load the resource designated by the element in the new frame. [/li]

[/list]
User agents may provide users with a mechanism to override the target attribute.


quindi visto che nel mio caso ho indicato il TARGET dovremmo rientrare nel caso 1:
Codice: [Seleziona]
If an element has its target attribute set to a known frame, when the element is activated (i.e., a link is followed or a form is processed), the resource designated by the element should be loaded into the target frame.[/

Quindi direi che dovrebbe comporsi come mi aspetto e quindi window.name mi deve ridare il valore impostato come target indipendentemente da come il link e' stato attivato.

o no? che ne dite?

Offline klades

  • Moderatore
  • Post: 5788
    • http://www.nic-nac-project.org/~kaosmos
Re: problemi window.name con FF1.5
« Risposta #6 il: 01 Febbraio 2006 12:13:51 »
Per la verità mi sembra che il tuo caso rientri al n°4, se non ho capito male stai aprendo una pagina nuova, non caricando la pagina in un frame esistente.
Comunque sia, è evidente che, dati i 4 casi, gli user-agent possono sempre sovrascrivere l'attributo TARGET, mi sembra sia scritto bello chiaro no? :-)

Offline robertoroberto

  • Post: 7
Re: problemi window.name con FF1.5
« Risposta #7 il: 01 Febbraio 2006 12:37:56 »
beh il mio codice scrive :
Codice: [Seleziona]
<a href="mypage.html" target="xxx">Click here</a>
Io di base non apro' una pagina nuova.. e' l'utente che poi decide di fare tasto destro open in new window. Di per se il codice ha come target "xxx" che e' una frame esistente.

Cmq cerchero' di provvedere in altro modo..
Grazie

0 Utenti e 2 Visitatori stanno visualizzando questo topic.