WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 02.03.2024 16:08:37

wasi
Mitglied

Dynamische Links für iFrames

Hallo, suche nach einer Lösung, um die src im iframe dynamisch zu ändern.
Evtl. eine Idee für ein Modul? Daher habe ich es hier gepostet.

Über andere Ideen würde ich mich freuen.

Es werden hier externe Inhalte geladen, daher iframe

Es ändert sich service=xxxx
zb. nach service=yyyy

<iframe frameborder="0" id="studio123-frame" src="https://www.studio123.com/site?src=fshp&service=xxxx" style="width: 100%; height: 800px;"></iframe>

Die Seite in dem der iframe ist:
../pages/iframeseite.php

Mit diesem o. ä. Link müsste dann die andere src vom iframe weiter gegeben werden.
../pages/iframeseite.php?service=xxxx
../pages/iframeseite.php?service=yyyy

Beitrag geändert von wasi (02.03.2024 16:09:11)


VG wasi

Offline

#2 02.03.2024 17:13:35

Slugger
Mitglied

Re: Dynamische Links für iFrames

Hallo wasi,
vielleicht hilft dir das weiter:
https://forum.wbce.org/viewtopic.php?id=3590


Hoster: ALL-INKL *** Grundsätzliche WBCE Konfig ***
WBCE: 1.5.4 • BE: 2.1.0 • PHP: 8.1.16 * 1. Projekt: FE: Simple responsive • BE: Argos * 2. Projekt: FE: hortal • BE: Argos * 3. Projekt: FE: WBCEZon • BE: Argos * 4. Projekt: FE: WBCETik • BE: Argos
Status Projekt 1-4:  OK

Online

Liked by:

wasi

#3 02.03.2024 18:03:11

wasi
Mitglied

Re: Dynamische Links für iFrames

Hallo Slugger,
danke für den Tipp. ...werde mich mal einlesen.


VG wasi

Offline

#4 03.03.2024 08:31:07

florian
Administrator

Re: Dynamische Links für iFrames


Code allein macht nicht glücklich. Jetzt spenden!

Offline

Liked by:

wasi

#5 03.03.2024 22:29:05

wasi
Mitglied

Re: Dynamische Links für iFrames

Hallo, habe eine Lösung.
Danke nochmal für alle Denkanstöße!!

<script>
    function updateIframeSrc() {
        // Get the iframe element
        var iframe = document.getElementById('myIframe');

        // Get the current URL parameters
        var urlParams = new URLSearchParams(window.location.search);

        // Get the service parameter value from the URL
        var serviceValue = urlParams.get('service');

        // Set the newSrc based on the service parameter value
        var newSrc = 'https://www.studio123.com/site?src=fshp&service=' + serviceValue;

        // Update src with the newSrc value
        iframe.src = newSrc;
    }

    // Call the function when the page loads
    updateIframeSrc();
</script>

VG wasi

Offline

Liked by:

Slugger

Fußzeile des Forums

up