AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Tuesday, 22 December 2015

Open popup in new tab without browser alert

In this article I am sharing an awesome trick how to open popup in a new tab without browser alert. Every time we try to open window in new tab browser will give alert Please allow popups. We can do this using jquery. this will explain in below given example.

script section
<script type="text/javascript">
function RedirecturlinNewTab(Actionurl)
{
 if ($('#redirectlnk').length == 0) {
                                $('body').append("<a id='redirectlnk'></a>");
                            }
  $('#redirectlnk').attr("href", Actionurl).attr("target", "_blank")[0].click();
}
</script>

body section
<body>
<input type="button" onclick="RedirecturlinNewTab('http://www.google.com')"/>
</body>
On click button new window tab will open without browser alert.

0 comments :

Post a Comment

  • Popular Posts
  • Comments