Issue Details (XML | Word | Printable)

Key: MDL-9614
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Martin Dougiamas
Reporter: Miguel Rosa
Votes: 3
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

onclick openpopup returns false gives error on Internet Explorer

Created: 28/Apr/07 12:27 AM   Updated: 19/Feb/09 12:00 AM
Component/s: Lib
Affects Version/s: 1.7.2
Fix Version/s: None

File Attachments: 1. Zip Archive erro.zip (29 kB)

Environment: FC6 with MySQL 5.0, Apache 2.2, PHP 5.2 and Moodle 1.7.2+

Database: MySQL
URL: http://moodle.escolas.fccn.pt/
Participants: kieran egan, Martin Dougiamas, Miguel Rosa and Rosario Carcò
Security Level: None
Affected Branches: MOODLE_17_STABLE


 Description  « Hide

There's a problem related with Javascript and Internet Explorer 7 (and maybe 6) that affects Moodle 1.7.2
I'm responsible for several Moodle instalations and version 1.6.4 was ok. After I upgraded to 1.7.2 I received reports that "opening files returns error when using IE". You can see the error in the attachment.

So, I did tests:

  • Firefox and Opera no problem at all
  • Haven't tested IE6 but got reports saying to have the same problem of IE7 (not sure though)
  • With IE7 I could successfully open JPG, GIF, XML files but couldn't DOC, XLS, PDF, ZIP (didn't try other types)
  • Still, for all file types I was able, with IE7, to right click and: "open in new tab", "open in new window" and "save target" with complete success.

So, the problem was with onclick that calls javascript function openpopup and I found out from Internet search that there are some issues with IE/XP/Vista. The problem is with "return false" and fixes can be tried with changing it to "return true" or playing with "href=" and avoiding "onclick".

I have chosen to "return true". The other browsers still behave nicely and IE stops giving error but only displays the window with message "you should receive the document in a new window, if it doesn't....". It doesn't, so people have to click the next link and it works.

I also tried to put before "return false" the following line
location.href=fullurl;
but IE7 gives the download file and also the error .
Then putting "return true" works fine on IE7 but the problem is that Firefox and Opera do double open: in new window and in current moodle window.....

so is there better solution?

Thanks



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Miguel Rosa added a comment - 01/Oct/07 09:24 PM

Hi,

Still waiting for a reply on this issue. Users that have IE browsers complain about not being very easy to download files specially for unexperienced users because of this error.

Resuming, the error occurs when:

  • using IE7 (and maybe IE6)
  • AND url link formed as pathinfo (type http://site/file.php/path/download.pdf)
  • AND the onclick associated function (openpopup) has "return false" in the end (with true works but has other behaviour problems)
  • AND the type of file being downloaded is of some kind (pdf, doc, xls, zip and maybe some others)

I see that this is probably a IE javascript bug (http://www.google.pt/search?q=%22return+false%22+onclick+IE) but there is maybe some way to solve this with changes in javascripts from Moodle.

The Moodle I'm using is Moodle 1.7.2 + (2006101020) and we have ModRewrite in Apache 2. Also AcceptPathInfo is on and PHP Safe Mode is off.

We are responsible for managing 260+ Moodles (listed below):
http://escolas.fccn.pt/moodleEDUPT/lista.php


Rosario Carcò added a comment - 05/Aug/08 10:19 PM
Hi, I just ran into the same problem with our Moodle 1.7.1+ and would be glad to get at least a hint on how to correct the Moodle Code myself if everybody is busy with Version 2 and 1.9.x

Thanks, Rosario Carcò


Miguel Rosa added a comment - 05/Aug/08 11:18 PM

Well, I never got a reply to this. And indeed I think its not their problem - its MS fault.

So, I posted a document explaining some solutions for all the people using the 470 Moodles we already deployed - but a solution on the users side:

(described in portuguese in this doc http://moodle.eb23-s-juliao-barra.rcts.pt/file.php/1/erro_ao_abrir_ficheiros.pdf)

1) Using IE, press CTRL key while clicking with the mouse over the file link to open it
or
2) Also using IE, press the menu (right) key of the mouse and choose any of the options: Open, Open in new tab/window, Save target as.
or
3) Use other browser (Firefox, Opera,...)

Also, editors (Admin, Course admins, Teachers) have the option when posting a document to open in the same window or new one. If they choose to open in the same window, there is no error. This problem only happens when the document is to be open on a new window.

These solutions might be not what you were looking for, but I think they are the correct ones. I tried to change Moodle code and I figured out I could be solving one problem to create a lot of other ones - getting it to work fine in IE, might change correct behaviour on the other browsers.


Rosario Carcò added a comment - 06/Aug/08 04:53 PM
Thanks a lot. Unfortunately there is no option if you put PDF-Files in a directory. I am going to upgrade to 1.9 this week-end, so I am curious to see whether something changes.

Rosario Carcò added a comment - 12/Aug/08 11:51 PM
I just upgraded our 1.7.1 to 1.9.2 and the problem has gone. So, even if MS IE did something strange, Moodle's code has changed also. The PDF-Files of a directory now correctly open in a new window even in IE7.

Rosario Carcò added a comment - 24/Sep/08 09:54 PM
Strangely this bad behaviour appeared again some weeks ago. One of our Windows Systems Engineer found this KB article of Microsoft, explaining the IE setting "Do not save encrypted files to disk" which applies for Sites using SSL as we do on our moodle: http://support.microsoft.com/kb/815313/en-us
So for the moment I am suggesting our users to allow saving the files.

kieran egan added a comment - 11/Nov/08 08:33 AM
This is my first moodle post so be kind.

Firstly I would like to see this fixed server side, rather then doing client based work arounds.
After troubleshooting client side I found that the following worked for me, let me know if others found this helpful.

If your using GP check if you have defined the following setting:
GP Location: Computer Settings\Administrative Templates\Windows Components\Internet Explorer
Key Name: Security Zones: Use only machine settings
Value: Enabled

If you want to check locally if this setting is defined then see if the following key is present:
HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
Key Name: Security_HKLM_only

If you change this GP setting to disabled, this key will be deleted.

If this fix doesnt work for you then you may want to check the following GP Seting:
GP Location: Computer Settings\Administrative Templates\Windows Components\Internet Explorer
Key Name: Security Zones: Do not allow users to change policies

Registry Value:
HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
RegKey Name: Security_options_edit
I have never defined this setting in GP so cant comment on its interplay with the security zones: use only machine settings.

Cheers
Kieran


Rosario Carcò added a comment - 19/Feb/09 12:00 AM
Of course Kieran is right: everything that can be solved on the server side will spare a lot of time and trouble for the users. Unfortunately GPOs are only useful for Windows-Workstations being part of a Windows-Domain. All other clients (not joined to a windows-domain) can not be configured this way. That's why I gave the according setting in Internet Explorer.

But there is also another server side possibility: if Microsoft would change their default settings or make Internet Explorer behave like any other Internet Browser. Probably Moodle's PHP Code can not even force that download on Internet Explorer because Micrsoft states that this feature is a security matter and option.

Rosario