WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 02.03.2024 15:08:37

wasi
Member

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

Last edited by wasi (02.03.2024 15:09:11)


VG wasi

Offline

#2 02.03.2024 16:13:35

Slugger
Member

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

Offline

Liked by:

wasi

#3 02.03.2024 17:03:11

wasi
Member

Re: Dynamische Links für iFrames

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


VG wasi

Offline

#4 03.03.2024 07:31:07

florian
Administrator

Re: Dynamische Links für iFrames


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

Liked by:

wasi

#5 03.03.2024 21:29:05

wasi
Member

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

Board footer

up