Booking.com Script lädt nicht in Wordpress

  • Hallo zusammen,

    ich bin neu hier und hoffe ihr könnt mir bei meinem Problem weiterhelfen.

    Ich möchte gerne unter Wordpress folgendes Script auf einer Seite laden.

    <script>
    (function() {
    var randomId = Math.floor(Math.random() * 100000);
    var targetElemId = 'bcom_rwidget_' + randomId;
    document.write('<div id="' + targetElemId + '"></div>');
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.async = true;
    script.src = 'http://www.booking.com/review_widget/…iew_widget&wid=' + targetElemId + '&wtype=box_big_feat&hotel_id=44177&widget_language=de';
    var node = document.getElementsByTagName('script')[0];
    node.parentNode.insertBefore(script, node);
    }());
    </script>

    Leider wird das Script nicht geladen. Wenn ich es einfach als html-Datei auf meinen Server lade, funktioniert es.

    Wie bekomme ich das ganze in Wordpress integriert. Ich verwende die neuste Wordpressversion.

    Danke und Gruß

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • Es gibt verschiedene Methoden: http://www.coder-welten.com/einbinden-von-javascript/
    Plugins dafür gibt es, glaube ich, auch.

    Danke für den Tipp, leider muss ich wohl den etwas komplizierten weg gehen.

    Mit dieser Variante "[COLOR=#004090][FONT=Consolas]<script[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]type[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]=[/FONT][/COLOR][COLOR=#004090][FONT=Consolas]"text/javascript"[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]src[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]=[/FONT][/COLOR][COLOR=#004090][FONT=Consolas]"http://www.example.com/datei.js"></script>" [/FONT][/COLOR]funktioniert es nicht.

  • ich habe gerade das exakt gleiche Problem mit diesem script:
    [COLOR=#666666]
    [/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] <script>[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] (function() {[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] var randomId = Math.floor(Math.random() * 100000);[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] var targetElemId = 'bcom_rwidget_' + randomId;[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] document.write('<div id="' + targetElemId + '"></div>');[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] var script = document.createElement('script');[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] script.type = 'text/javascript';[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] script.async = true;[/FONT][/COLOR][/COLOR]
    [COLOR=#000000][FONT=arial] script.src = 'http://www.booking.com/review_widget/ch/[/FONT][/COLOR][FONT=arial][COLOR=#000000]bergsucht-ruhpolding.de[/COLOR][/FONT][COLOR=#000000][FONT=arial].html?tmpl=review_widget/review_widget&wid=' + targetElemId + '&wtype=box_big_feat&hotel_id=1936693[/FONT][/COLOR][COLOR=#000000][FONT=arial]&widget_language=de[/FONT][/COLOR][COLOR=#000000][FONT=arial]';[/FONT][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] var node = document.getElementsByTagName('script')[0];[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] node.parentNode.insertBefore(script, node);[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] }());[/FONT][/COLOR][/COLOR]
    [COLOR=#666666][COLOR=#000000][FONT=arial] </script>

    kann mir da jemand behilflich sein ??

    Gruß, Olle
    [/FONT][/COLOR]
    [/COLOR]

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!