1

I currently have a safecracker login form which enables specific users to login and download files. [click here][1] I have noticed when a user logs in they are redirected to the following link [click here][2], however the link loads in the same window. Is there a way to do this where once the user has logged in an a new window/tab is created with the download credentials? Below is a snippet of my return= code.

{exp:member:login_form return="press/promo/{segment_3}"}
4
  • the return can't open new windows. However you can return to a page that uses javascript to do the opening of a new window with the promo-page.
    – GDmac
    Apr 29 '13 at 10:31
  • You can submit the pop-up login form with Ajax and can open download in new window/tab with JavaScript. Apr 29 '13 at 16:44
  • @BhashkarYadav can you elaborate on this please,
    – NewBoy
    Apr 29 '13 at 17:17
  • @NewBoy Sure, I posted answer with example code. Hope, it would help you. Apr 29 '13 at 17:41
1

I would suggest you to have easy approach by using "jQuery Form Plugin" (http://malsup.com/jquery/form/). To get some better ideas see the examples. For the Ajax submit you can use the code like:

$(document).ready(function() { 
var options = {
beforeSubmit : function(){},
success : function(data, status, oo){
window.open ('[URL]', '[Window Title]');
}
}; 
$('#FORM_ID').ajaxForm(options);
});

See within the success function, window.open will open the given URL in new window. For more about window.open take a reference from http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

Hope, it would help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.