2

the issue is that I'm trying to develop a web site and I'm using Google Web Design. So far so good. I've inserted an iFrame and I want to change it's source when I'm pressing a button. Every search that I've googled speaks about "src" but my iFrame has "source" attribute. I've tried almost every solution that I found but I gave up. It may be a stupid question but how am I supposed to do it? I've used "document.getElementById("myId")" or "window.frames['id']"... Not a chance. Anyone have an idea? Thanks a lot.

<iframe is="gwd-iframe" id="textToShow" source="" class="gwd-iframe-15nv gwd-gen-mv4zgwdanimation" style="background-image: none;" scrolling="auto">
</iframe>

gwd.goOnTheWeb = function(event) {
    //should be in here
};
AlexG
  • 5,649
  • 6
  • 26
  • 43
Ady Năstase
  • 249
  • 2
  • 9
  • Are you trying to change the location from inside the iframe oder from the page the iframe is embedded to? – pmayer Nov 02 '15 at 14:41
  • My button is calling a function that is suppose to change that *** source via getElement.... or anything else. Everything is in one page. – Ady Năstase Nov 02 '15 at 14:43
  • Without seeing your actual HTML of both parent and frame, we're only able to make wild guesses. Also, please describe what changes to the iFrame you're trying to make. And,if the iFrame comes from a different domain than the parent, you cannot change the iFrame from the parent for browser security reasons. – jfriend00 Nov 02 '15 at 14:48
  • OK, this is my iframe: – Ady Năstase Nov 02 '15 at 15:06
  • and my function... gwd.goOnTheWeb = function(event) { //should be in here }; – Ady Năstase Nov 02 '15 at 15:12

3 Answers3

3

Please take a look into Google Web Designer Help > The iFrame component.

Valentin Podkamennyi
  • 7,161
  • 4
  • 29
  • 44
1

After some researches I've managed it. Finally, in Google Web Design there is an option in the right-click -> Add event... on an imageButton, called iFrame, that allows you to load an external page into an iframe. On the other hand, hopefully, I've found that somehow the "source" attribute of an iframe that the software writes automatically in code (I'm using OS X), is about to "guide" Safari while "src" is for browsing on Windows. Excuse me, please if I'm kind of "out-of-topic" but even being in IT, I've never developed a site since. So, have mercy. :)

Ady Năstase
  • 249
  • 2
  • 9
0
myBtn.onclick = function() {
    var filepath = 'video/hollywood-movies-2.mp4';
    document.getElementById('textToShow').src = filepath ;
}
Aniket kumar
  • 65
  • 1
  • 12