Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:37:13+00:00 2026-06-07T00:37:13+00:00

I have a web application that allows users to enter search criteria and the

  • 0

I have a web application that allows users to enter search criteria and the results get appended to a portlet container right below the input fields for the search criteria (mentioned above).
Environment – JSP, JAVA, and TAG libraries
The search page essentially consists of a few JSP pages which reference a myriad tag libraries.

After the search results are returned (AJAX) – the portlet iframe should re-size based on the new height. A JavaScript method (resident to one of the tag libraries) called setContainerHeight is what does this re-sizing.

The problem –

Internet Explorer does not call my JS method which does this re-size!

I suspect that the following post could help with this problem.
Javascript IE Event

Chrome, Firefox, Opera….all do!

Since I cannot explicitly tell the page to refresh (I will loose my search criteria parameters), nor can I explicitly check what type of browser is making the request (my JavaScript is not getting called); how can I explicitly tell the page to call my resize method after the callback?

In case anyone was curious – this is my re-size method:

function setContainerHeight() {
  //reset the height to shrink the scroll height for the usecase where the portlet's contents got smaller.

  getPortlet().style.height = '${frameHeight}px';
  getPortlet().height = '${frameHeight}px';

  try {
     height = getFrameHeight(getPortlet());
  } catch (e) {
    //fallback for crossdomain permission problems.
    height = '${frameHeight}';
  }

  //set the portlet & portlet container to be the same height - not using 100% for the portlet to avoid the inner scrollbar
  try {
    getPortletContainer().style.height = height + 'px';
  } catch ( ex ) {
      // do nothing, we can't get to the container
  }
  getPortlet().style.height = (height + getHorScrollBarHeight()) + 'px';
  getPortlet().height = (height + getHorScrollBarHeight()) + 'px';
}

And this is the section of the code that calls this method –

/* resizes the portlet container to fit the size of the porlet. */
function resizePortletContainer() {

  if (hasContainerHeightChanged()) {
    saveScrollPosition();
    setContainerHeight();
    restoreScrollPosition();
  }

  //width handling needs some work
  //if (hasContainerWidthChanged()) {
    //setContainerWidth();
  //}
}

//registering event handlers...
var frame = getPortlet();
var prevPortletLoadEvent = frame.onload ? frame.onload : function () {};
frame.onload = function () {prevPortletLoadEvent(); resizePortletContainer(); };

var prevPortletResizeEvent = frame.onresize ? frame.onresize : function () {};
var onresize = function () {prevPortletResizeEvent(); resizePortletContainer(); };

A bit more information –
After placing alert statements after the register event handler code above; I noticed that both IE and Firefox called this portion of code only ONCE (my alert box was triggered only once in either case when the initial search screen was displayed to the browser.) Thus, that leads me to believe that for some reason, only Firefox likes the above code that I am using to register my events; IE perhaps is looking for a different method of registering this event?

I suspect that the following post could be useful in my search for the answer to this problem —

Javascript IE Event

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:37:15+00:00Added an answer on June 7, 2026 at 12:37 am

    I found my answer in another post, but essentially the problem was that Internet Explorer registers its iframe events differently than all other browsers.
    Also a good post for you to look at – iframe behaviour of onload vs addEventListener('load')

    The code that I used to fix the problem is listed below. I hope this helps someone else that gets into a similar problem I had.

    I had to do a simple check on what browser was making the request and the 2 conditional blocks that you see below do the same thing, except the syntax is different for IE. Good ‘ol IE. LoL.

    //Microsoft Internet Explorer Browser - iFrame event register
    if (navigator.appName.indexOf("Microsoft") != -1) {
      var frame = getPortlet();
      var prevPortletLoadEvent = frame.onload ? frame.onload : function () {};
      var refresh = function() { prevPortletLoadEvent(); resizePortletContainer(); };
    
      if(frame.attachEvent) frame.attachEvent('onload', refresh);
      else frame.addEventListener('load', refresh, false);
    }
    
    //All other major browsers - iFrame event register
    else {
      var frame = getPortlet();
      var prevPortletLoadEvent = frame.onload ? frame.onload : function () {};
      frame.onload = function () {prevPortletLoadEvent(); resizePortletContainer(); };
    
      var prevPortletResizeEvent = frame.onresize ? frame.onresize : function () {};
      var onresize = function () {prevPortletResizeEvent(); resizePortletContainer(); };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that allows users to create an account, and in
I have a web application that allows users to build a 'client list.' We
Let say, I have a web application that allows users to upload images and
I have a web application that has a dynamic javascript calendar, which allows users
I have a ASP.NET web application that allows end users to upload a file.
I have a web application that allows users to upload certain documents relevant to
We have created a web application, using ASP.NET, that allows users to upload documents
I have a rails web application that allows users to run automated tasks with
I have a web application that allows a user to view family members. When
I have a web application that uses two databases. DB1 Users perform their CRUD

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.