Zum Inhalt springen

Unterschiedliche Behandling von Quotes bei 4.1.1 und 4.2 bei externer geladener JS-Datei

Erstellt am 25. Februar 2009 · 4 Antworten · letzte Antwort am 25. Februar 2009

Tags: JavaScript & AJAX, Frage

danton ·

Hi
Ich habe ein seltsames Phänomen.
In meiner Ext wird ein Bookmarklink generiert.
Diese Funktion ist ein JS das in der Ext reingeladen wird.
Das komische ist jetzt nun das lokal auf ner 4.2 alles sauber läuft.
Nur Online auf ner 4.1.1 hat er Probleme mit gequoteten Anführungszeichen.

lokales generiertes JS

if (document.all && !window.opera){ //IE5+6
    document.write("<a href="\" javascript:windowexternaladdfavorite="" p_url="" p_title="">" + p_description + "</a>");
    
}else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){ //Gecko
    document.write("<a href="\" javascript:windowsidebaraddpanel="" p_title="" p_url="" title="\">" + p_description + "</a>");
}else{
    document.write("<a href="\" p_url="" title="\" p_title="" rel="\" sidebar="">" + p_description + "</a>");
}

Online generiertes JS

if (document.all && !window.opera){ //IE5+6
    document.write("<a href="\" javascript:windowexternaladdfavorite="" p_url="" p_title="">" + p_description + "</a>");
}else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){ //Gecko
    document.write("<a href="\" javascript:windowsidebaraddpanel="" p_title="" p_url="" title="\">" + p_description + "</a>");
}else{
    document.write("<a href="\" p_url="" title="\" p_title="" rel="\" sidebar="">" + p_description + "</a>");
}

Da scheint kein Unterschied zu sein.

Original JS-Code vor generierung

if (document.all && !window.opera){ //IE5+6
    document.write("<a href="\"javascript:window.external.addFavorite('"" p_url="" p_title="">" + p_description + "</a>");
    
}else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){ //Gecko
    document.write("<a href="\"javascript:window.sidebar.addPanel" p_title="" p_url="" title="\""">" + p_description + "</a>");
}else{
    document.write("<a href="\""" p_url="" title="\""" p_title="" rel="\"sidebar\"">" + p_description + "</a>");
}

Lokal JS write

<a title="Websitename" href="javascript:window.sidebar.addPanel ('Websitename', 'http://localhost:8508/index.php?id=406&no_cache=1','');">> Bookmark this!</a>

Online JS write kommt nix nur ein Fehler

Fehler: illegal character
Quelldatei: http://www.kunde.de/index.php?id=8&L=0
Zeile: 173, Spalte: 29
Quelltext:
    document.write("<a href="\" javascript:windowexternaladdfavorite="" p_url="" p_title="">" + p_description + "</a>");

Habe es lokal mit/ohne Frames und mit/ohne TV getestet.
Da tuts bei allen wunderbar

Warum hat er bei ner 4.1.1 nen Problem mit den Quotes?

Danke und Gruß
Danton

danton ·

Hi
Vielleicht ja.
Aber auf ein vielleicht hin kann ich schlecht nen kompletten Server umstellen. ;-)
Vor allem weil wir nicht nur 1 T3-Installation haben mit 4.1.1.

Ich werde mal schauen das ich ne Kopie mache und die dann aktualisiere.

Hat jemand vielleicht noch ne andere Idee?

Danke und Gruß
Danton

just2b ·

naja du verrätst ja nicht wie du das js inkludierst, ansonstne da mal im code schauen ob sich was verändert hat. zudem wenn das inline läuft vielleicht eine ext die da stört wie sourceopt oder tidy usw

danton ·

Hi

naja du verrätst ja nicht wie du das js inkludierst

$this->jsScript   = '<script type="text/javascript">
  <!--
    var p_description = "'.$this->conf["bookmark_title"].'";
    var p_title = "'.$this->conf["bookmark_name"].'";
    var p_url = "'.$serverurl.$this->pi_linkTP_keepPIvars_url($overrulePIvars=array(),$cache=0,$clearAnyway=0,$altPageId=0).'";
  -->
  </script>
';
$markerArray["###BOOKMARK###"] = $this->jsScript.$this->cObj->fileResource("EXT:konfigurator/static/bookmark.js");
$markerArray["###BOOKMARK###"] = $this->cObj->dataWrap($markerArray["###BOOKMARK###"],$this->conf["bookmark_title."]["wrap"]);
$content = $this->cObj->substituteMarkerArrayCached($template["gesamt"], $markerArray, $subpartArray);

ansonstne da mal im code schauen ob sich was verändert hat

Meinst im Ext Code?
Die sind beide auf dem gleichen Stand.
Habe mir mal die Online-Ext ins lokale installiert - gleiches Ergebnis.
Lokal tuts online nicht.

wenn das inline läuft vielleicht eine ext die da stört wie sourceopt oder tidy usw

Hm gute Frage aber sourceopt und tidy läuft nicht.
Gibts da ne gute Möglichkeit das rauszufinden?

Was halt etwas dagegen spricht ist das der generierte Code online und lokal
gleich sind.

Habe es auch mit/ohne XHTML ausprobiert ändert auch nix.

Gruß Danton