$(document).ready(function() { if(window.location.href.indexOf('#myModal') != -1) { $('#myModal').modal('show'); } });