Redirection Javascript via SRC

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steph

    Redirection Javascript via SRC

    Bonjour,

    Je souhaite lancer une redirection vers un fichier php via SRC= dans une
    condition if (voir ci-dessous en bas du script) mais la redirection ne
    fonctionne pas. Par contre la condition est bien validée car le cookie (crée
    précédemment) est bien effacé par SetCookie.
    Pourriez-vous me dire ce qui ne va pas ?

    Merci d'avance
    Steph

    <SCRIPT language="javas cript" type="text/javascript">
    var pathname=locati on.pathname;
    var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
    var date_exp = new Date();
    var date_del = new Date();
    date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de 1
    heure
    date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le cookie

    function SetCookie (name, value) {
    var argv=SetCookie. arguments;
    var argc=SetCookie. arguments.lengt h;
    var expires=(argc > 2) ? argv[2] : null;
    var path=(argc > 3) ? argv[3] : null;
    var domain=(argc > 4) ? argv[4] : null;
    var secure=(argc > 5) ? argv[5] : false;
    document.cookie =name+"="+escap e(value)+
    ((expires==null ) ? "" : (";
    expires="+expir es.toGMTString( )))+
    ((path==null) ? "" : ("; path="+path))+
    ((domain==null) ? "" : ("; domain="+domain ))+
    ((secure==true) ? "; secure" : "");
    }

    function getCookieVal(of fset) {
    var endstr=document .cookie.indexOf (";", offset);
    if (endstr==-1)
    endstr=document .cookie.length;
    return unescape(docume nt.cookie.subst ring(offset, endstr));
    }
    function GetCookie (name) {
    var arg=name+"=";
    var alen=arg.length ;
    var clen=document.c ookie.length;
    var i=0;
    while (i<clen) {
    var j=i+alen;
    if (document.cooki e.substring(i, j)==arg)
    return getCookieVal (j);
    i=document.cook ie.indexOf(" ",i)+1;
    if (i==0) break;}
    return null;
    }


    // CHECK IF INDEX VALUE SET
    var index=GetCookie ("Index");
    if (index!="") {
    src=http://www.siteweb.com/fichier.php?par tnerID=partner;
    //DELETE COOKIE
    SetCookie("Inde x","",date_del, myDomain);
    }

    </SCRIPT>


  • Steph

    #2
    Re: Redirection Javascript via SRC


    "Steph" <mcvalb@hotmail .com> a écrit dans le message de news:
    432f47cf$0$1486 9$626a14ce@news .free.fr...[color=blue]
    > Bonjour,
    >
    > Je souhaite lancer une redirection vers un fichier php via SRC= dans une
    > condition if (voir ci-dessous en bas du script) mais la redirection ne
    > fonctionne pas. Par contre la condition est bien validée car le cookie
    > (crée précédemment) est bien effacé par SetCookie.
    > Pourriez-vous me dire ce qui ne va pas ?
    >
    > Merci d'avance
    > Steph
    >
    > <SCRIPT language="javas cript" type="text/javascript">
    > var pathname=locati on.pathname;
    > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
    > var date_exp = new Date();
    > var date_del = new Date();
    > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de 1
    > heure
    > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le cookie
    >
    > function SetCookie (name, value) {
    > var argv=SetCookie. arguments;
    > var argc=SetCookie. arguments.lengt h;
    > var expires=(argc > 2) ? argv[2] : null;
    > var path=(argc > 3) ? argv[3] : null;
    > var domain=(argc > 4) ? argv[4] : null;
    > var secure=(argc > 5) ? argv[5] : false;
    > document.cookie =name+"="+escap e(value)+
    > ((expires==null ) ? "" : (";
    > expires="+expir es.toGMTString( )))+
    > ((path==null) ? "" : ("; path="+path))+
    > ((domain==null) ? "" : ("; domain="+domain ))+
    > ((secure==true) ? "; secure" : "");
    > }
    >
    > function getCookieVal(of fset) {
    > var endstr=document .cookie.indexOf (";", offset);
    > if (endstr==-1)
    > endstr=document .cookie.length;
    > return unescape(docume nt.cookie.subst ring(offset, endstr));
    > }
    > function GetCookie (name) {
    > var arg=name+"=";
    > var alen=arg.length ;
    > var clen=document.c ookie.length;
    > var i=0;
    > while (i<clen) {
    > var j=i+alen;
    > if (document.cooki e.substring(i, j)==arg)
    > return getCookieVal (j);
    > i=document.cook ie.indexOf(" ",i)+1;
    > if (i==0) break;}
    > return null;
    > }
    >
    >
    > // CHECK IF INDEX VALUE SET
    > var index=GetCookie ("Index");
    > if (index!="") {
    > src=http://www.siteweb.com/fichier.php?par tnerID=partner;
    > //DELETE COOKIE
    > SetCookie("Inde x","",date_del, myDomain);
    > }
    >
    > </SCRIPT>
    >[/color]
    A la fin du script, il y a une petite erreur, partner = index.


    Comment

    • web.dev

      #3
      Re: Redirection Javascript via SRC


      Steph wrote:[color=blue]
      > Bonjour,
      >
      > Je souhaite lancer une redirection vers un fichier php via SRC= dans une
      > condition if (voir ci-dessous en bas du script) mais la redirection ne
      > fonctionne pas. Par contre la condition est bien validée car le cookie (crée
      > précédemment) est bien effacé par SetCookie.
      > Pourriez-vous me dire ce qui ne va pas ?
      >
      > Merci d'avance
      > Steph
      >
      > <SCRIPT language="javas cript" type="text/javascript">
      > var pathname=locati on.pathname;
      > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
      > var date_exp = new Date();
      > var date_del = new Date();
      > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de 1
      > heure
      > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le cookie
      >
      > function SetCookie (name, value) {
      > var argv=SetCookie. arguments;
      > var argc=SetCookie. arguments.lengt h;
      > var expires=(argc > 2) ? argv[2] : null;
      > var path=(argc > 3) ? argv[3] : null;
      > var domain=(argc > 4) ? argv[4] : null;
      > var secure=(argc > 5) ? argv[5] : false;
      > document.cookie =name+"="+escap e(value)+
      > ((expires==null ) ? "" : (";
      > expires="+expir es.toGMTString( )))+
      > ((path==null) ? "" : ("; path="+path))+
      > ((domain==null) ? "" : ("; domain="+domain ))+
      > ((secure==true) ? "; secure" : "");
      > }
      >
      > function getCookieVal(of fset) {
      > var endstr=document .cookie.indexOf (";", offset);
      > if (endstr==-1)
      > endstr=document .cookie.length;
      > return unescape(docume nt.cookie.subst ring(offset, endstr));
      > }
      > function GetCookie (name) {
      > var arg=name+"=";
      > var alen=arg.length ;
      > var clen=document.c ookie.length;
      > var i=0;
      > while (i<clen) {
      > var j=i+alen;
      > if (document.cooki e.substring(i, j)==arg)
      > return getCookieVal (j);
      > i=document.cook ie.indexOf(" ",i)+1;
      > if (i==0) break;}
      > return null;
      > }
      >
      >
      > // CHECK IF INDEX VALUE SET
      > var index=GetCookie ("Index");
      > if (index!="") {
      > src=http://www.siteweb.com/fichier.php?par tnerID=partner;[/color]

      I believe the problem is here. You should change it to:

      window.location .href =
      "http://www.siteweb.com/fichier.php?par tnerID=partner" ;
      [color=blue]
      > //DELETE COOKIE
      > SetCookie("Inde x","",date_del, myDomain);
      > }
      >
      > </SCRIPT>[/color]

      Comment

      • Steph

        #4
        Re: Redirection Javascript via SRC


        "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
        1127172393.9722 10.326090@f14g2 00...legr oups.com...

        Steph wrote:[color=blue]
        > Bonjour,
        >
        > Je souhaite lancer une redirection vers un fichier php via SRC= dans une
        > condition if (voir ci-dessous en bas du script) mais la redirection ne
        > fonctionne pas. Par contre la condition est bien validée car le cookie
        > (crée
        > précédemment) est bien effacé par SetCookie.
        > Pourriez-vous me dire ce qui ne va pas ?
        >
        > Merci d'avance
        > Steph
        >
        > <SCRIPT language="javas cript" type="text/javascript">
        > var pathname=locati on.pathname;
        > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
        > var date_exp = new Date();
        > var date_del = new Date();
        > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de 1
        > heure
        > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le cookie
        >
        > function SetCookie (name, value) {
        > var argv=SetCookie. arguments;
        > var argc=SetCookie. arguments.lengt h;
        > var expires=(argc > 2) ? argv[2] : null;
        > var path=(argc > 3) ? argv[3] : null;
        > var domain=(argc > 4) ? argv[4] : null;
        > var secure=(argc > 5) ? argv[5] : false;
        > document.cookie =name+"="+escap e(value)+
        > ((expires==null ) ? "" : (";
        > expires="+expir es.toGMTString( )))+
        > ((path==null) ? "" : ("; path="+path))+
        > ((domain==null) ? "" : ("; domain="+domain ))+
        > ((secure==true) ? "; secure" : "");
        > }
        >
        > function getCookieVal(of fset) {
        > var endstr=document .cookie.indexOf (";", offset);
        > if (endstr==-1)
        > endstr=document .cookie.length;
        > return unescape(docume nt.cookie.subst ring(offset, endstr));
        > }
        > function GetCookie (name) {
        > var arg=name+"=";
        > var alen=arg.length ;
        > var clen=document.c ookie.length;
        > var i=0;
        > while (i<clen) {
        > var j=i+alen;
        > if (document.cooki e.substring(i, j)==arg)
        > return getCookieVal (j);
        > i=document.cook ie.indexOf(" ",i)+1;
        > if (i==0) break;}
        > return null;
        > }
        >
        >
        > // CHECK IF INDEX VALUE SET
        > var index=GetCookie ("Index");
        > if (index!="") {
        > src=http://www.siteweb.com/fichier.php?par tnerID=partner;[/color]

        I believe the problem is here. You should change it to:

        window.location .href =
        "http://www.siteweb.com/fichier.php?par tnerID=partner" ;
        [color=blue]
        > //DELETE COOKIE
        > SetCookie("Inde x","",date_del, myDomain);
        > }
        >
        > </SCRIPT>[/color]
        Yes that's work fine !
        Can you just tell me how i can pass the variable index to the php file.
        Indeed with the 'http://www.siteweb.com/fichier.php?par tnerID=index"; the
        partnerID equal index but not equal to variable contained into index.

        Many thanks
        Steph


        Comment

        • web.dev

          #5
          Re: Redirection Javascript via SRC


          Steph wrote:[color=blue]
          > "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
          > 1127172393.9722 10.326090@f14g2 00...legr oups.com...
          >
          > Steph wrote:[color=green]
          > > Bonjour,
          > >
          > > Je souhaite lancer une redirection vers un fichier php via SRC= dans une
          > > condition if (voir ci-dessous en bas du script) mais la redirection ne
          > > fonctionne pas. Par contre la condition est bien validée car le cookie
          > > (crée
          > > précédemment) est bien effacé par SetCookie.
          > > Pourriez-vous me dire ce qui ne va pas ?
          > >
          > > Merci d'avance
          > > Steph
          > >
          > > <SCRIPT language="javas cript" type="text/javascript">
          > > var pathname=locati on.pathname;
          > > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
          > > var date_exp = new Date();
          > > var date_del = new Date();
          > > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de 1
          > > heure
          > > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le cookie
          > >
          > > function SetCookie (name, value) {
          > > var argv=SetCookie. arguments;
          > > var argc=SetCookie. arguments.lengt h;
          > > var expires=(argc > 2) ? argv[2] : null;
          > > var path=(argc > 3) ? argv[3] : null;
          > > var domain=(argc > 4) ? argv[4] : null;
          > > var secure=(argc > 5) ? argv[5] : false;
          > > document.cookie =name+"="+escap e(value)+
          > > ((expires==null ) ? "" : (";
          > > expires="+expir es.toGMTString( )))+
          > > ((path==null) ? "" : ("; path="+path))+
          > > ((domain==null) ? "" : ("; domain="+domain ))+
          > > ((secure==true) ? "; secure" : "");
          > > }
          > >
          > > function getCookieVal(of fset) {
          > > var endstr=document .cookie.indexOf (";", offset);
          > > if (endstr==-1)
          > > endstr=document .cookie.length;
          > > return unescape(docume nt.cookie.subst ring(offset, endstr));
          > > }
          > > function GetCookie (name) {
          > > var arg=name+"=";
          > > var alen=arg.length ;
          > > var clen=document.c ookie.length;
          > > var i=0;
          > > while (i<clen) {
          > > var j=i+alen;
          > > if (document.cooki e.substring(i, j)==arg)
          > > return getCookieVal (j);
          > > i=document.cook ie.indexOf(" ",i)+1;
          > > if (i==0) break;}
          > > return null;
          > > }
          > >
          > >
          > > // CHECK IF INDEX VALUE SET
          > > var index=GetCookie ("Index");
          > > if (index!="") {
          > > src=http://www.siteweb.com/fichier.php?par tnerID=partner;[/color]
          >
          > I believe the problem is here. You should change it to:
          >
          > window.location .href =
          > "http://www.siteweb.com/fichier.php?par tnerID=partner" ;
          >[color=green]
          > > //DELETE COOKIE
          > > SetCookie("Inde x","",date_del, myDomain);
          > > }
          > >
          > > </SCRIPT>[/color]
          > Yes that's work fine !
          > Can you just tell me how i can pass the variable index to the php file.
          > Indeed with the 'http://www.siteweb.com/fichier.php?par tnerID=index"; the
          > partnerID equal index but not equal to variable contained into index.
          >
          > Many thanks
          > Steph[/color]

          If I understood correctly, then this is what you want:

          window.location .href = "http://url" + index;

          Hope this helps :)

          Comment

          • Steph

            #6
            Re: Redirection Javascript via SRC


            "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
            1127241356.2601 92.129130@g47g2 00...legr oups.com...

            Steph wrote:[color=blue]
            > "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
            > 1127172393.9722 10.326090@f14g2 00...legr oups.com...
            >
            > Steph wrote:[color=green]
            > > Bonjour,
            > >
            > > Je souhaite lancer une redirection vers un fichier php via SRC= dans une
            > > condition if (voir ci-dessous en bas du script) mais la redirection ne
            > > fonctionne pas. Par contre la condition est bien validée car le cookie
            > > (crée
            > > précédemment) est bien effacé par SetCookie.
            > > Pourriez-vous me dire ce qui ne va pas ?
            > >
            > > Merci d'avance
            > > Steph
            > >
            > > <SCRIPT language="javas cript" type="text/javascript">
            > > var pathname=locati on.pathname;
            > > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
            > > var date_exp = new Date();
            > > var date_del = new Date();
            > > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de 1
            > > heure
            > > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le
            > > cookie
            > >
            > > function SetCookie (name, value) {
            > > var argv=SetCookie. arguments;
            > > var argc=SetCookie. arguments.lengt h;
            > > var expires=(argc > 2) ? argv[2] : null;
            > > var path=(argc > 3) ? argv[3] : null;
            > > var domain=(argc > 4) ? argv[4] : null;
            > > var secure=(argc > 5) ? argv[5] : false;
            > > document.cookie =name+"="+escap e(value)+
            > > ((expires==null ) ? "" : (";
            > > expires="+expir es.toGMTString( )))+
            > > ((path==null) ? "" : ("; path="+path))+
            > > ((domain==null) ? "" : ("; domain="+domain ))+
            > > ((secure==true) ? "; secure" : "");
            > > }
            > >
            > > function getCookieVal(of fset) {
            > > var endstr=document .cookie.indexOf (";", offset);
            > > if (endstr==-1)
            > > endstr=document .cookie.length;
            > > return unescape(docume nt.cookie.subst ring(offset,
            > > endstr));
            > > }
            > > function GetCookie (name) {
            > > var arg=name+"=";
            > > var alen=arg.length ;
            > > var clen=document.c ookie.length;
            > > var i=0;
            > > while (i<clen) {
            > > var j=i+alen;
            > > if (document.cooki e.substring(i, j)==arg)
            > > return getCookieVal (j);
            > > i=document.cook ie.indexOf(" ",i)+1;
            > > if (i==0) break;}
            > > return null;
            > > }
            > >
            > >
            > > // CHECK IF INDEX VALUE SET
            > > var index=GetCookie ("Index");
            > > if (index!="") {
            > > src=http://www.siteweb.com/fichier.php?par tnerID=partner;[/color]
            >
            > I believe the problem is here. You should change it to:
            >
            > window.location .href =
            > "http://www.siteweb.com/fichier.php?par tnerID=partner" ;
            >[color=green]
            > > //DELETE COOKIE
            > > SetCookie("Inde x","",date_del, myDomain);
            > > }
            > >
            > > </SCRIPT>[/color]
            > Yes that's work fine !
            > Can you just tell me how i can pass the variable index to the php file.
            > Indeed with the 'http://www.siteweb.com/fichier.php?par tnerID=index"; the
            > partnerID equal index but not equal to variable contained into index.
            >
            > Many thanks
            > Steph[/color]

            If I understood correctly, then this is what you want:

            window.location .href = "http://url" + index;

            Hope this helps :)

            Yes it works, thanks !
            Last question (if you don't mind) : if i have more than one javascript
            variable to pass with the URL to the php file like
            http://url.php?partner 1=$index1&partn er2=$index2&par tner3=$index3 what is
            the exact synthax to use with window.location .href ?


            Comment

            • web.dev

              #7
              Re: Redirection Javascript via SRC


              Steph wrote:[color=blue]
              > "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
              > 1127241356.2601 92.129130@g47g2 00...legr oups.com...
              >
              > Steph wrote:[color=green]
              > > "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
              > > 1127172393.9722 10.326090@f14g2 00...legr oups.com...
              > >
              > > Steph wrote:[color=darkred]
              > > > Bonjour,
              > > >
              > > > Je souhaite lancer une redirection vers un fichier php via SRC= dans une
              > > > condition if (voir ci-dessous en bas du script) mais la redirection ne
              > > > fonctionne pas. Par contre la condition est bien validée car le cookie
              > > > (crée
              > > > précédemment) est bien effacé par SetCookie.
              > > > Pourriez-vous me dire ce qui ne va pas ?
              > > >
              > > > Merci d'avance
              > > > Steph
              > > >
              > > > <SCRIPT language="javas cript" type="text/javascript">
              > > > var pathname=locati on.pathname;
              > > > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
              > > > var date_exp = new Date();
              > > > var date_del = new Date();
              > > > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de1
              > > > heure
              > > > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le
              > > > cookie
              > > >
              > > > function SetCookie (name, value) {
              > > > var argv=SetCookie. arguments;
              > > > var argc=SetCookie. arguments.lengt h;
              > > > var expires=(argc > 2) ? argv[2] : null;
              > > > var path=(argc > 3) ? argv[3] : null;
              > > > var domain=(argc > 4) ? argv[4] : null;
              > > > var secure=(argc > 5) ? argv[5] : false;
              > > > document.cookie =name+"="+escap e(value)+
              > > > ((expires==null ) ? "" : (";
              > > > expires="+expir es.toGMTString( )))+
              > > > ((path==null) ? "" : ("; path="+path))+
              > > > ((domain==null) ? "" : ("; domain="+domain ))+
              > > > ((secure==true) ? "; secure" : "");
              > > > }
              > > >
              > > > function getCookieVal(of fset) {
              > > > var endstr=document .cookie.indexOf (";", offset);
              > > > if (endstr==-1)
              > > > endstr=document .cookie.length;
              > > > return unescape(docume nt.cookie.subst ring(offset,
              > > > endstr));
              > > > }
              > > > function GetCookie (name) {
              > > > var arg=name+"=";
              > > > var alen=arg.length ;
              > > > var clen=document.c ookie.length;
              > > > var i=0;
              > > > while (i<clen) {
              > > > var j=i+alen;
              > > > if (document.cooki e.substring(i, j)==arg)
              > > > return getCookieVal (j);
              > > > i=document.cook ie.indexOf(" ",i)+1;
              > > > if (i==0) break;}
              > > > return null;
              > > > }
              > > >
              > > >
              > > > // CHECK IF INDEX VALUE SET
              > > > var index=GetCookie ("Index");
              > > > if (index!="") {
              > > > src=http://www.siteweb.com/fichier.php?par tnerID=partner;[/color]
              > >
              > > I believe the problem is here. You should change it to:
              > >
              > > window.location .href =
              > > "http://www.siteweb.com/fichier.php?par tnerID=partner" ;
              > >[color=darkred]
              > > > //DELETE COOKIE
              > > > SetCookie("Inde x","",date_del, myDomain);
              > > > }
              > > >
              > > > </SCRIPT>[/color]
              > > Yes that's work fine !
              > > Can you just tell me how i can pass the variable index to the php file.
              > > Indeed with the 'http://www.siteweb.com/fichier.php?par tnerID=index";t he
              > > partnerID equal index but not equal to variable contained into index.
              > >
              > > Many thanks
              > > Steph[/color]
              >
              > If I understood correctly, then this is what you want:
              >
              > window.location .href = "http://url" + index;
              >
              > Hope this helps :)
              >
              > Yes it works, thanks !
              > Last question (if you don't mind) : if i have more than one javascript
              > variable to pass with the URL to the php file like
              > http://url.php?partner 1=$index1&partn er2=$index2&par tner3=$index3 what is
              > the exact synthax to use with window.location .href ?[/color]

              In that case you would do something like this:

              window.location .href = "http://url.php?partner 1=" + index1 +
              "&partner2= " + index2 + "&partner3= " + index3;

              Comment

              • Steph

                #8
                Re: Redirection Javascript via SRC


                "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
                1127248811.6780 47.259830@g49g2 00...legr oups.com...

                Steph wrote:[color=blue]
                > "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
                > 1127241356.2601 92.129130@g47g2 00...legr oups.com...
                >
                > Steph wrote:[color=green]
                > > "web.dev" <web.dev.cs@gma il.com> a écrit dans le message de news:
                > > 1127172393.9722 10.326090@f14g2 00...legr oups.com...
                > >
                > > Steph wrote:[color=darkred]
                > > > Bonjour,
                > > >
                > > > Je souhaite lancer une redirection vers un fichier php via SRC= dans
                > > > une
                > > > condition if (voir ci-dessous en bas du script) mais la redirection ne
                > > > fonctionne pas. Par contre la condition est bien validée car le cookie
                > > > (crée
                > > > précédemment) est bien effacé par SetCookie.
                > > > Pourriez-vous me dire ce qui ne va pas ?
                > > >
                > > > Merci d'avance
                > > > Steph
                > > >
                > > > <SCRIPT language="javas cript" type="text/javascript">
                > > > var pathname=locati on.pathname;
                > > > var myDomain=pathna me.substring(0, pathname.lastIn dexOf('/')) +'/';
                > > > var date_exp = new Date();
                > > > var date_del = new Date();
                > > > date_exp.setTim e(date_exp.getT ime()+(3600*100 0)); // cookie de
                > > > 1
                > > > heure
                > > > date_del.setTim e(date_del.getT ime()-(365*24*3600*10 00)); // Tuer le
                > > > cookie
                > > >
                > > > function SetCookie (name, value) {
                > > > var argv=SetCookie. arguments;
                > > > var argc=SetCookie. arguments.lengt h;
                > > > var expires=(argc > 2) ? argv[2] : null;
                > > > var path=(argc > 3) ? argv[3] : null;
                > > > var domain=(argc > 4) ? argv[4] : null;
                > > > var secure=(argc > 5) ? argv[5] : false;
                > > > document.cookie =name+"="+escap e(value)+
                > > > ((expires==null ) ? "" : (";
                > > > expires="+expir es.toGMTString( )))+
                > > > ((path==null) ? "" : ("; path="+path))+
                > > > ((domain==null) ? "" : ("; domain="+domain ))+
                > > > ((secure==true) ? "; secure" : "");
                > > > }
                > > >
                > > > function getCookieVal(of fset) {
                > > > var endstr=document .cookie.indexOf (";", offset);
                > > > if (endstr==-1)
                > > > endstr=document .cookie.length;
                > > > return unescape(docume nt.cookie.subst ring(offset,
                > > > endstr));
                > > > }
                > > > function GetCookie (name) {
                > > > var arg=name+"=";
                > > > var alen=arg.length ;
                > > > var clen=document.c ookie.length;
                > > > var i=0;
                > > > while (i<clen) {
                > > > var j=i+alen;
                > > > if (document.cooki e.substring(i, j)==arg)
                > > > return getCookieVal (j);
                > > > i=document.cook ie.indexOf(" ",i)+1;
                > > > if (i==0) break;}
                > > > return null;
                > > > }
                > > >
                > > >
                > > > // CHECK IF INDEX VALUE SET
                > > > var index=GetCookie ("Index");
                > > > if (index!="") {
                > > > src=http://www.siteweb.com/fichier.php?par tnerID=partner;[/color]
                > >
                > > I believe the problem is here. You should change it to:
                > >
                > > window.location .href =
                > > "http://www.siteweb.com/fichier.php?par tnerID=partner" ;
                > >[color=darkred]
                > > > //DELETE COOKIE
                > > > SetCookie("Inde x","",date_del, myDomain);
                > > > }
                > > >
                > > > </SCRIPT>[/color]
                > > Yes that's work fine !
                > > Can you just tell me how i can pass the variable index to the php file.
                > > Indeed with the 'http://www.siteweb.com/fichier.php?par tnerID=index";
                > > the
                > > partnerID equal index but not equal to variable contained into index.
                > >
                > > Many thanks
                > > Steph[/color]
                >
                > If I understood correctly, then this is what you want:
                >
                > window.location .href = "http://url" + index;
                >
                > Hope this helps :)
                >
                > Yes it works, thanks !
                > Last question (if you don't mind) : if i have more than one javascript
                > variable to pass with the URL to the php file like
                > http://url.php?partner 1=$index1&partn er2=$index2&par tner3=$index3 what is
                > the exact synthax to use with window.location .href ?[/color]

                In that case you would do something like this:

                window.location .href = "http://url.php?partner 1=" + index1 +
                "&partner2= " + index2 + "&partner3= " + index3;

                Great !
                Many thanks for your quick support


                Comment

                Working...