Forum

Accueil » Alloy UI » English

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Sofia Lucas
Change URL dynamically inside an Iframe
18 août 2014 01:31
Réponse

Sofia Lucas

Rang: New Member

Publications: 13

Date d'inscription: 12 juin 2014

Publications Récentes

Hello,

I need to change dynamically the URL of an Iframe in Liferay 6.2 . In Liferay's wiki, they exposed the method of concatenating the new url of the iframe with the URl of the page
1http://localhost:8585/web/guest/home#http://www.google.com    
,
but it didn't work for me.

Do you have any idea about other methods ?
Sofia Lucas
RE: Change URL dynamically inside an Iframe
20 août 2014 09:31
Réponse

Sofia Lucas

Rang: New Member

Publications: 13

Date d'inscription: 12 juin 2014

Publications Récentes

Any idea please ? I searched for the reason why it doesn't work for me , but I didn't find anything .
Pankaj Kathiriya
RE: Change URL dynamically inside an Iframe
20 août 2014 22:25
Réponse

Pankaj Kathiriya

Rang: Liferay Master

Publications: 697

Date d'inscription: 4 août 2010

Publications Récentes

Just appending url after # wont help, you have to refresh the page then iframe will take url appended after #.
Sofia Lucas
RE: Change URL dynamically inside an Iframe
25 août 2014 01:27
Réponse

Sofia Lucas

Rang: New Member

Publications: 13

Date d'inscription: 12 juin 2014

Publications Récentes

@pankaj , Thank you . But even with refreshing the page , it doesn't work
Pankaj Kathiriya
RE: Change URL dynamically inside an Iframe
25 août 2014 02:38
Réponse

Pankaj Kathiriya

Rang: Liferay Master

Publications: 697

Date d'inscription: 4 août 2010

Publications Récentes

Have you tried window.location= url to refresh the page?
Sofia Lucas
RE: Change URL dynamically inside an Iframe
25 août 2014 08:47
Réponse

Sofia Lucas

Rang: New Member

Publications: 13

Date d'inscription: 12 juin 2014

Publications Récentes

Yep, I did. But it's not working neither . It seems to be a problem related to the version of Liferay , I mean "6.2" .
Sofia Lucas
RE: Change URL dynamically inside an Iframe
4 septembre 2014 02:53
Réponse

Sofia Lucas

Rang: New Member

Publications: 13

Date d'inscription: 12 juin 2014

Publications Récentes

What I decided finally is creating a Js script that has access to the Iframe of my page , and changes its sourceUrl with a new value .
Frederic Bonin
RE: Change URL dynamically inside an Iframe
10 septembre 2014 10:20
Réponse

Frederic Bonin

Rang: New Member

Publications: 5

Date d'inscription: 23 juin 2011

Publications Récentes

Hi,
I had the same issue, I looked at the source /portal-web/docroot/html/portlet/iframe and debugged and found out that they added a new feature to set the iframe location to a specific iframe. Thus, the syntax changed.

Before :
http://localhost:8585/web/guest/home#http://www.google.com

After
http://localhost:8585/web/guest/home#<portletID>=http://www.google.com
Example : http://localhost:8585/web/guest/home#_48_INSTANCE_K6cmhmmeKqB9_=http://www.google.com
Sofia Lucas
RE: Change URL dynamically inside an Iframe
11 septembre 2014 01:25
Réponse

Sofia Lucas

Rang: New Member

Publications: 13

Date d'inscription: 12 juin 2014

Publications Récentes

Thank you for this relpy . Actually, I made a JS script , and it's working fine:

 1
 2// Getting the iframe
 3var iframeTag= window.frames[0];
 4// Getting its source url
 5var x =  iframeTag.location.href;
 6// Making some operations to build the new url
 7var pos = x.lastIndexOf('/');
 8x=x.substring(0, pos);
 9var url = window.location.href; //This is the url of the whole page
10if(url.indexOf("?") >0 ){
11var argumenturl= url.substring(url.indexOf("?")+1);
12 x=x.concat(argumenturl);
13
14// Putting the new url in the Iframe
15iframeTag.location.href=x;