Loading an .html file inside an iFrame?

6310679, modified 15 Years ago. New Member Posts: 5 Join Date: 11/1/10 Recent Posts
Hi,

I'm trying to display an .html file inside an iFrame that's contained in a JSP.

I've set the iframe's src property to a number of values without any success: 'file.html', 'portlet_name/file.html', 'portlet_name/WEB-INF/file.html'. None of them work.

I get an error saying something like:

requested resource was not found.

http://localhost:8080/web/guest/file.html


Where should I place the file in my portlet? What should I set the src property of the iFrame to?

I'm using Spring Portlet MVC, in case it makes a difference.

thanks,
rob
thumbnail
4753419, modified 15 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
If you place your html file in the document library, you'll be able to use the url presented by document library.
6310679, modified 15 Years ago. New Member Posts: 5 Join Date: 11/1/10 Recent Posts
Hitoshi Ozawa:
If you place your html file in the document library, you'll be able to use the url presented by document library.


Thanks for your suggestion.

I have a couple of problems with your solution. First, the URL provided in the document library will not display the page, but rather prompt the user for a download. The WebDAV URL does work for displaying the page, but requires a login (which wouldn't be great in a public portal).

Second, the document ID generated by the Document Library would not be constant between different environments (dev, test, and prod), so I'd have to extract the link to a properties files, or modify the containing jsp for each instance.

I've found that if I place the .html file inside ${TOMCAT}/webapps/ROOT/html/, I can access it, but I feel uncomfortable placing files inside Liferay's ROOT application.

Any way of doing it from inside a portlet?

Regards
thumbnail
4753419, modified 15 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
Second, the document ID generated by the Document Library would not be constant between different environments (dev, test, and prod), so I'd have to extract the link to a properties files, or modify the containing jsp for each instance.


Liferay 6.x has a new feature to access files in Document Library using the following URLs:
http://localhost:8080/document/[group-id]/[folder-id]/[encoded-title]
http://localhost:8080/document/[group-id]/[uuid]
http://localhost:8080/document/[shortcut-id]

Also, it may be helpful to think about using Liferay's Staging to publish to a production server.
Marcos Laurito, modified 13 Years ago. Junior Member Posts: 99 Join Date: 4/18/13 Recent Posts
I'm having this exact problem and i cant resolve it.
I've upload one simple html file to documents & media. I'm trying to display it using an iFrame on another page of the same site but it doesn't work. When i load the page that contains the iframe it prompts me to download the file configured in the iFrame but i want it to be displayed directly in the iFrame... I've been trying using the URL and WebDavURL and is the same...
Alla Sapozhnikova, modified 12 Years ago. Junior Member Posts: 82 Join Date: 3/2/12 Recent Posts
Hi Marcos,

I am trying to solve the same problem. Have you found a solution yet?

Thank you,
Alla
Marcos Laurito, modified 12 Years ago. Junior Member Posts: 99 Join Date: 4/18/13 Recent Posts
Alla Sapozhnikova:
Hi Marcos,

I am trying to solve the same problem. Have you found a solution yet?

Thank you,
Alla



Hi. No i couldn't find a solution for this...
Sorry
thumbnail
Vilmos Papp, modified 12 Years ago. Liferay Master Posts: 529 Join Date: 10/21/10 Recent Posts
Perhaps you can set this property in your portal-ext.properties to display the .html file instead of download, but I think if you want to display an HTML content a web content display would be the proper solution.


    #
    # Input a list of comma delimited extensions for which the content
    # disposition header has to be set to "inline".
    #
    mime.types.content.disposition.inline=flv,gif,jpg,pdf,png,swf,wmv
thumbnail
Vilmos Papp, modified 12 Years ago. Liferay Master Posts: 529 Join Date: 10/21/10 Recent Posts
What would you like to achieve by showing an html file in an iframe? I mean what is your use case?