What's the code for displaying a dynamic page inside an iframe?
The page I'm trying to load is something like this: https://www.example.com/stuff/${wixUsers.currentUser.id}
How do I display that?
Thanks.
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Hello Manny,
${wixUsers.currentUser.id} should be replaced with the id of the current user.
For that to happen, you need to have "wixUsers" properly defined by adding this to the beginning of your code file: import wixUsers from 'wix-users';
In addition, you need to make sure that at time of call "wixUsers.currentUser.id" as a valid value. Is a user logged in ? You can check that by logging the value to the console: console.log(wixUsers.currentUser.id)
If these don't help, please give us your site url so we can try and help further.
Well, I did write the entire URL as well and it didn't do jack... I already tried all sorts of things and it's just not working.The part that doesn't seem to be working is ${wixUsers.currentUser.id} Please help, I already waited a couple of days for this I keep getting obvious answers. Why is it so dificult for the wix team to understand my question?
If the dynamic url you chose is represented by the user's id so you wrote the code correctly except you didn't write the beginning of the URL.
I really don't know how else to explain it, you guys.
Ok yes, but how do I display a dynamic page with a dynamic URL?
Hi,
I don't understand exactly what you are trying to achieve but when you define the src you need to write the full URL ( for example - https://www.wix.com/code/home).
I'm trying to fetch a dynamic URL that contains ${wixUsers.currentUser.id} but I don't know how to do that,I'm using the following code:
$w.onReady(function () { $w('#html6').src=`/Afiliados/Registro/${wixUsers.currentUser.id}`; });
What am I doing wrong here?
Thanx.
Hello Manny,
I'm not sure i understand your use case. Why do you need a dynamic page to be opened in an iframe ?
You can try adding an html component (= iframe) and setting it to show the url of your dynamic page, either statically via the component's settings panel, or dynamically by changing it's "src" sttribute (https://www.wix.com/code/reference/$w.HtmlComponent.html).