URL - New Window option in version 3.7

URL - New Window option in version 3.7

by Andi Townshend -
Number of replies: 4
I have changed the admin settings so that "New Window" is now an option for opening URL resources.
However, when clicking on such a resource, rather than opening in a new tab straight away, the user is taken to an intermediate page which displays a link that says Click {URL} link to open resource. They then have to click on this link and the URL opens in a new tab i.e. click two things instead of one.

We have had to resort to using the Label resource which gives you the option to tick a box open in new window and this works as expected.
I have read elsewhere that older versions of Moodle had this issue, but none seem to have stated that it was fixed i.e. some say upgrading to Moodle 2.4 fixed it, whilst others say it didn't.

I need to get the URL resource working as Teachers will be adding these, and trying to explain to them how to do this is going to be a pain...

Average of ratings: -
In reply to Andi Townshend

Re: URL - New Window option in version 3.7

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I've tried this on Moodle 3.7 and it worked as expected — i.e. one click required — with the browsers I've tried (Firefox and Chrome).

To confirm what I did was:

  1. As a site admin: Went to Site administrationPluginsActivity modulesURL and selected "New window" in Available display options.
  2. As a teacher: Added a URL resource setting both Name and External URL, and set Display to "New window".
  3. As a student: Entered the course and clicked the URL. A new browser tab opens displaying the external URL. Only one click has been made.

Can you tell us what browser (type/version) you see the unexpected behaviour with?

When Display is set to "New window" the link gets an onclick attribute which calls window.open() to make the browser open a new tab. It's opened with a link to the Moodle resource (mod/url/view.php?id=XX&redirect=1) which should cause Moodle to redirect immediately without showing the intermediate page.


In reply to Leon Stringer

Re: URL - New Window option in version 3.7

by Andi Townshend -

Hi Leon and thanks for your reply.

I have retried this today and it appears to be working! It does however mean that when they go back to the original tab, the "second" page with the click this link message is displayed, but it is now opening in a new tab..

Many thanks

In reply to Andi Townshend

Re: URL - New Window option in version 3.7

by Matthias Giger -
Picture of Particularly helpful Moodlers
I think the problem is related to the course format.

When I use the Tiles format, I get the same behaviour.
With the Topic format it works as expected.

I've informed the author of the Tiles course format about the problem.
Average of ratings: Useful (2)