使用模式打开新选项卡,并在laravel项目中重定向旧页面

时间:2020-03-18 23:27:43

标签: javascript html laravel

我尝试在laravel项目中使用标签打开带有模式的新标签,并将旧标签重定向到另一页

我尝试了很多解决此问题的方法,但我没有得到结果 解决方案之一是

  <a onclick="window.open('https://www.w3schools.com');" data-toggle="modal" data-target="#Mymodal{{$question->id}}">Open Modal</a>   

它打开了带有链接的新标签,但我需要留在模态页面中

我认为此解决方案之一

<a href="{{route('mypage,$question->id')}}" target="_blank" onclick="location.replace('https://www.w3schools.com');"></a>

并且我在控制器中添加了新功能以使用jquery代码打开页面以加载模态

<script>
     $(window).load(function(){        
       $('#Mymodal{{$question->id}}').modal('show');

        }); 
</script>

我仍然无法重定向旧标签

1 个答案:

答案 0 :(得分:0)

//html
<a id="click" href="www.abc.com" target="_blank"></a>  //link to open in new tab


//script
{
  $("#click").click();
  window.location.replace("http://stackoverflow.com"); // link to redirect the current tab
}

相关问题