R – Page Viewer Web Part

iframemosssharepointweb-parts

I wanted to know if,

1. We can view a section/portlet of an external portal/Web Application?

Using Page Viewer Web part we get a full view of the web application but I would like to ONLY view a section/portlet of the external web page. Is this possible?

2.How to achieve session aware Page viewer web part

a. For e.g.,

i. I have logged in to an external application using the Page Viewer Web part

ii. Edit my calendar event which resides on a different Web part in the same page, doing this opens up a new page.

iii. Then, on applying the changes to the calendar event my complete page gets refreshed and I m logged out of my external application in the Page Viewer Web part.
b. And in second scenario, if we have SSO enabled for that application then the user will get logged in again but loose session.

3.How to handle Ajax calls of external applications.

For e.g., if an external application is having its authentication using Ajax, then using Page Viewer it is not possible to use SSO for that application.

I would greatly appreciate if you can share your thoughts on the above.

Best Answer

The Page Viewer Web Part is very limited. It just puts an iframe tag into the page and that's about it. So think instead of "Can these things be done in an iframe?".

The contents of an iframe can be accessed via JavaScript. This is the best/only option for these requirements. Some thoughts on the points in your question:

  1. Use JavaScript to set the CSS attribute display:none on elements in the document inside the iframe. This will collapse the elements you don't want to see leaving the rest. Of course if the HTML of the page inside the iframe is changed your script will break so not very maintainable.

  2. As soon as the page containing the iframe is changed then all references to it are destroyed. See more information from someone else trying a similar thing in this SO question.

  3. Similar to 2 and 1. Your options are limited but you may be able to use JavaScript to do it.

To summarise: The Page Viewer Web Part is designed to display static content and that's all you'll get out of it. Consider other options for your requirements if you can. If you need help with one please detail the requirements in a new question and we'll do our best to help.