From 068d0ce692aff5f093d8f9ba1fe6a7915a9bd55e Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Wed, 9 Oct 2013 11:45:56 +0300 Subject: [PATCH] Added back check in JS for empty or default URL. --- common/lib/xmodule/xmodule/js/src/lti/lti.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/js/src/lti/lti.js b/common/lib/xmodule/xmodule/js/src/lti/lti.js index 96ad075220..9454b0c346 100644 --- a/common/lib/xmodule/xmodule/js/src/lti/lti.js +++ b/common/lib/xmodule/xmodule/js/src/lti/lti.js @@ -37,7 +37,7 @@ window.LTI = (function () { // // @return undefined function initialize(element) { - var form, openInANewPage; + var form, openInANewPage, formAction; // In cms (Studio) the element is already a jQuery object. In lms it is // a DOM object. @@ -47,6 +47,16 @@ window.LTI = (function () { element = $(element); form = element.find('.ltiLaunchForm'); + formAction = form.attr('action'); + + // If action is empty string, or action is the default URL that should + // not cause a form submit. + if (!formAction || formAction === 'http://www.example.com') { + + // Nothing to do - no valid action provided. Error message will be + // displaced in browser (HTML). + return; + } // We want a Boolean 'true' or 'false'. First we will retrieve the data // attribute, and then we will parse it via native JSON.parse().