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...
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:
- As a site admin: Went to Site administration → Plugins → Activity modules → URL and selected "New window" in Available display options.
- As a teacher: Added a URL resource setting both Name and External URL, and set Display to "New window".
- 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.
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
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.
Thanks Matthias!
I am also using the Tiles format!