Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › How to set attachment download with new tab
- This topic has 15 replies, 2 voices, and was last updated 6 years, 9 months ago by Eric.
-
AuthorPosts
-
July 7, 2017 at 5:01 pm #120058EricSpectatorHi there, How to set attachment downloading with new tab in unit? If I download like PDF, by default, it will open in the same window instead of downloading .July 8, 2017 at 9:32 am #120143H.K. LatiyanParticipantTry adding the bellow code in your wplms-customizer.php file present in your wplms customizer plugin: add_action('wplms_after_start_course',function(){ ?> <script> jQuery(document).ready(function(){ jQuery('.unitattachments #attachments a').attr('target','_blank'); }); </script> <?php });July 8, 2017 at 9:38 am #120146EricSpectatorI tried this code looks not working.July 10, 2017 at 6:38 am #120237H.K. LatiyanParticipantIt seems like you are using the ajax in course status page, then instead of the above code use the bellow code: add_action('wplms_after_start_course',function(){ ?> <script> jQuery(document).ready(function(){ jQuery('.unit_content').on('unit_traverse',function(){ jQuery('.unitattachments #attachments a').attr('target','_blank'); }); }); </script> <?php });July 10, 2017 at 6:52 am #120243EricSpectatorstill not working. I have setting: Ajax disabled in course unit loadsJuly 10, 2017 at 7:19 am #120252H.K. LatiyanParticipantIf the ajax is disabled then the first code I shared works fine . Where are you adding the code ? It works fine on my test setup.July 10, 2017 at 7:41 am #120259EricSpectatorJuly 10, 2017 at 10:15 am #120285H.K. LatiyanParticipantThere is no js file to edit because this is not available in wplms, the above script is a simple js trick to open any link in the new window tab.July 10, 2017 at 10:17 am #120286H.K. LatiyanParticipantTry coping only the code inside the script tag (including script tag) from the above code and then add it in the wplms->footer->google analytics code. Let me know if it works from there.July 10, 2017 at 12:45 pm #120307EricSpectatorstill not working. just confirm can it work on your side? Are you using a pdf as attachment?July 11, 2017 at 6:50 am #120395H.K. LatiyanParticipantYes I am using a pdf, refer this video: http://screencast-o-matic.com/watch/cbiX1dlqhHJuly 11, 2017 at 7:20 am #120406EricSpectatorHi, I am using modern theme, can you try use modern theme?July 11, 2017 at 7:55 am #120421H.K. LatiyanParticipantHi.. You are using modern theme, I didn't know about it. The modern theme has different course status page and the hook is different in modern theme. For modern theme with ajax disabled in course status page you can use the bellow code: add_action('wplms_course_start_after_timeline',function(){ ?> <script> jQuery(document).ready(function(){ jQuery('.unitattachments #attachments a').attr('target','_blank'); }); </script> <?php });July 11, 2017 at 8:13 am #120427EricSpectatorThat's great. many thanks. it works now. Btw, I have another problem, when I set the Unit Duration parameter as "seconds", but the the course status page on left-up corner is still for mins, how can I resolve. I am using modern themeJuly 11, 2017 at 10:00 am #120454H.K. LatiyanParticipantHi... Please create new topics for new issues. I am unable to replicate the duration issue on my test setup, refer: http://prntscr.com/fu90ne
-
AuthorPosts
- The topic ‘How to set attachment download with new tab’ is closed to new replies.