Custom menu problem with target="_blank

Custom menu problem with target="_blank

by Brian Evans -
Number of replies: 5

I am using Moodle 2.7, Elegance theme and trying to add custom menus from Appearance>Themes>Theme Settings.  This works fine, except when I try to set target="_blank  per the Moodle docs instructions.


Basically, setting the target works fine with menu items like this:

Web Site | http://www.website.org" target="_blank | This is a web site


But loads the URL in the same window for menu items like this:

Web Site2 | http://www.website2.org/?page_id=66" target="_blank | This is another web site


The URL in the address bar for Web Site2 looks like this:

http://www.website2.org/?page_id=66" target%3D"_blank


For some reason Moodle doesn't like the data appended to the URL.  Unfortunately, many web sites built with Wordpress, Joomla, Drupal, etc., use this system.

How can I work around this?

Thanks.

Average of ratings: -
In reply to Brian Evans

Re: Custom menu problem with target="_blank

by Brian Evans -

Reported as a bug to the tracker - MDL-46781

In reply to Brian Evans

Re: Custom menu problem with target="_blank

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Does this tracker help? MDL-35420 It suggests creating a short custom URL.
In reply to Mary Cooch

Re: Custom menu problem with target="_blank

by Brian Evans -

Thanks, Mary.  I guess I didn't search hard enough before creating a new issue. 

I thought of using a URL shortener but most of those exist to track your browsing by various methods and I do my best to avoid that sort of thing.  This seems like something that could be fixed relatively easily within Moodle.

In reply to Brian Evans

Re: Custom menu problem with target="_blank

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Worth voting for thensmile

In reply to Mary Cooch

Re: Custom menu problem with target="_blank

by Brian Evans -

Found a workaround for this by creating my own URL shortener.  It's not ideal but it works. 

I followed the directions at this link for creating a very short (10 lines) URL shortening script you can host on your server:

http://tutorialzine.com/2013/12/quick-tip-create-a-simple-url-shortener-with-10-lines-of-php/


I had problems with parsing the .ini file so I just created an array like the author suggests.

Works perfectly.