The hotpot module changes my links

The hotpot module changes my links

by Josep M. Fontana -
Number of replies: 3
Hi,

I introduced a link in some of my hotpot exercises that when clicked took the user to a feedback activity within the same course. The URL I intruduced was this:

http://parles.upf.es/moodle/mod/feedback/view.php?id=1283

This worked flawlessly with the hot potatoes exercise outside the hotpot module but once I upload the exercise via the hotpot module, when the linked is clicked, it takes me to the following URL:

http://parles.upf.es/moodle/mod/hotpot/%5BURL%5D

I used JavaScript to insert the link:

<a style="cursor: pointer; text-decoration: underline;" onclick="window.open('http://parles.upf.es/moodle/mod/feedback/view.php?id=1283');return false;">here</a>

Why is this happening this to me? smile

Josep M.
Average of ratings: -
In reply to Josep M. Fontana

Re: The hotpot module changes my links

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Josep,
I don't think the HotPot module is changing your links. I think they are being changed by Moodle when you upload the HTML to your site.

Being a security concious system, Moodle doesn't like "onclick" event handlers added to any <HTML> tags, so it changes them to "Xonclick" so they don't work. This is to prevent someone adding evil, javascript to seemingly harmless <HTML> content.

I wonder if the link would work if you changed it to the following:

<a style="cursor: pointer; text-decoration: underline;" href="http://parles.upf.es/moodle/mod/feedback/view.php?id=1283" target="_blank">here</a>

all the best
Gordon

 P.S. Out of interest, if you decode "%5BURL%5D", you get "[URL]"

In reply to Gordon Bateson

Re: The hotpot module changes my links

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Josep,

have you modified the HP templates in the "mod/hotpot/templates/v6" folder? I think the "[URL]" is coming from there. Anyway, if you modify the links so they don't use the Javascript "onclick" to open the new window, but instead use the html "target" attribute, I think the problem will be solved.

cheers
Gordon

In reply to Gordon Bateson

Re: The hotpot module changes my links

by Josep M. Fontana -
Damn! I had the target attribute first, but Martin Holmes scolded me and told me I had to be XHTML compliant and use JavaScript to open new windows. This is what happens to me for being a good boy smile.

Thanks a lot, Gordon.

Josep M.