When iFrame Resizer is activated, AJAX calls do not fire in various Admin areas such as Views UI and Rules UI. I am using jQuery Update, but having tried all other versions of jQuery I ruled it out as contributing to the error. Disabling "This site will host resizable iFrames" fixes the problem.

I'm using Drupal 7.50.
AdvAGG JS disabled.
I have "iFrame Resizer JavaScript console logging" on.

Here is the error text I get in Inspector:

Uncaught TypeError: settings.iframe_resizer_options.maxHeight.toUpperCase is not a function (iframe_resizer.js?oeui18:25)
     attach @ iframe_resizer.js?oeui18:25
     (anonymous function) @ drupal.js?oeui18:76
     each @ jquery.js?v=1.10.2:665
     Drupal.attachBehaviors @ drupal.js?oeui18:74
     insert @ ajax.js?v=7.50:570
     Drupal.ajax.success @ ajax.js?v=7.50:428
     success @ ajax.js?v=7.50:189
     fire @ jquery.js?v=1.10.2:3048
     fireWith @ jquery.js?v=1.10.2:3160
     done @ jquery.js?v=1.10.2:8235
     callback @ jquery.js?v=1.10.2:8778

Comments

fatmarker created an issue. See original summary.

markdc’s picture

Issue summary: View changes
markdc’s picture

Title: iframe_resizer.js conflicting with AJAX in Views UI » iframe_resizer.js conflicting with AJAX in admin interface
milodesc’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for the detailed error report.

I haven't been able to reproduce the error. I've installed the iframe resizer module and views/view ui. Even with "This site will host resizable iFrames" checked I'm able to get to the views UI.

Do you happen to have something strange in the "Maximum height of the iFrame' field?

markdc’s picture

I left the default value of 'Maximum height' as "Infinity". However, I had a value of "600" in the 'Minimum height' field. I cleared that and made sure all other fields had their default value. The problem still occurs.

In the end if I disable "Override the default behavior of the iFrame Resizer library" the problem is resolved and all Ajax links in Views UI work again. I can live with that for now.

milodesc’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Active

Thanks for the follow-up, fatmarker.

I'm not sure how i missed it the other day, but I'm now able reproduce the issue.

It has nothing to do with how you configured the settings. Just a bug with my JavaScript. I hope to have a fix later today.

  • milodesc committed 39f2673 on 7.x-1.x
    Issue #2817865 by fatmarker, milodesc: Errors occur in iframe_resizer.js...
milodesc’s picture

Title: iframe_resizer.js conflicting with AJAX in admin interface » Errors occur in iframe_resizer.js when JS behaviors are called after the initial page load
Status: Active » Fixed

I've pushed a fix for the issue and will create a new release momentarily.

The problem:
In iframe_resizer.js, the module converts module configuration variables into JS types that the iFrame Resizer library needs. The maxHeight and maxWidth config variables were causing errors in this process.

The script was first checking if maxHeight/maxWidth was "infinity" (with any combination of lower and uppercase letters). If so, it converted "Infinity" (a string) to Infinity (the JavaScript property):

if (settings.iframe_resizer_options.maxHeight === '' || settings.iframe_resizer_options.maxHeight.toUpperCase() === 'infinity'.toUpperCase()) {
  settings.iframe_resizer_options.maxHeight = Infinity;
}

This worked fine on initial page load, but when behaviors were fired again iframe_resizer.js tried to do the conversions again. This time however, when the script was checking to see if the conversion was necessary, maxHeight and maxWidth could already be Infinity (the JS property), and therefore the toUpperCase() function couldn't run, resulting in an error.

The solution:
There is no need to run the conversions every time behaviors are run, it only needs to happen once per page load. Therefore, I moved the conversions out of Drupal behaviors and the issue was fixed. In addition, the script no longer converts to the Infinity JS property since the library accepts "Infinity".

milodesc’s picture

milodesc’s picture

markdc’s picture

Looks good. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.