Html iframe doesn't run on other page

Hi,

I tried to make an onClick event for a button, so when it being clicked the link (url address) will open on a different page in embed mode.
It seems like the code is fine, but when running I have nothing on the other page.

The code as I wrote it at the moment:
page 1:

import {session} from ‘wix-storage’;
import wixLocation from ‘wix-location’;

export function text65_click (event, $w) {
let url=$w(“#text65”).text;
session.setItem(‘external’, url);
wixLocation.to(“/page2”);
}

Page 2:

export function external_html (event, $w) {
let geturl=session.getItem(‘external’);
$w(“#html1”).src=geturl;
}

Thanks for the help…

When you console.log the geturl, do you get a valid URL?

Hey, thanks for replying!
The link doesn’t open on the other page, but if I’m trying in the same page it works…

so, for now I succeeded to preform the url address in the html iframe by using the dataset api, but once the value of a session referrd to the second page it is not possible to repeat it. in a proffesional language let’s say that the session been setted for once and I want to repeat the proccess more than once.

Code:

Page 1:

import wixData from 'wix-data';
import {session} from 'wix-storage'; 
import wixLocation from 'wix-location'; 

export function button1_click() {
     let seturl=$w("#dataset1").getCurrentItem().url;
      session.setItem('ext', seturl);
       wixLocation.to("/page-2");
}

Page 2:

import {session} from 'wix-storage'; 
import wixLocation from 'wix-location'; 

$w.onReady(function () {
    $w("#dataset1").onReady( () => {
          let geturl=session.getItem('ext');
           $w("#html1").src=geturl;
           $w("#html1").scrolling = "no";
              session.clear();
         })
});


Btw, is this possible to get to a value that defined as a reference in a dataset?
I couldn’t get the value from the object.

Thanks a lot to the helpers.

Hi,
Please share your editor’s URL so we can inspect,