asp.net mvc - MVC configure using Modal bootstrap -
i using bootstrap modal in header - layout page entire site
e.g. original code bootstap
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mymodal"> launch login demo modal </button> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-body"> login information </div> </div> </div> </div>
the above code work.
i modified button code link
<a href="#mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mymodal">launch login demo modal 2</a>
when user clicks on link code works, user has access url link , open in new window/new tab
when user right clicks on link , choose "open in new tab" fail because page not open.e.g.
http://example.com/account/login#mymodal http://example.com/blog#mymodal
question : possible if user opens in new tab url, redirect http://example.com/account/login
page
a live example fiverr.com (click on join modal opens) , can access direct link fiverr.com/join using mvc, maybe using route configurations?
you cat javascript. part of url after hash , check if expected, , open modal manually:
if(window.location.hash) { var hash = window.location.hash.substring(1); if (hash == "mymodel"){ $('#mymodal').modal('show'); } }
make sure, code being executed after page loaded.
Comments
Post a Comment