Open popup Window when popup is block from browser

Posted by Rakesh Singh under ASP.NET on 4/30/2013 | Points: 10 | Views : 2692 | Status : [Member] | Replies : 2
Hello friends,

I have to open a popup window through c# code on button click open popup condition is that popup block from browser
and without use of AJAX.
we can use pure c# code or javascript function call in C# code.
please give me solution.




Responses

Posted by: Satyapriyanayak on: 4/30/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
<html>
<head>
<title>PopUp Window</title>

<script type="text/javascript">
function popup(url) {
var width = 300;
var height = 200;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
var params = 'width=' + width + ', height=' + height;
params += ', top=' + top + ', left=' + left;
params += ', toolbar=no';
params += ', menubar=no';
params += ', resizable=yes';
params += ', directories=no';
params += ', scrollbars=no';
params += ', status=no';
params += ', location=no';
newwin = window.open(url, 'd', params);
if (window.focus)
{
newwin.focus()
}
return false;
}
</script>


</head>
<form>

<input type="button" value="Click me" onclick="popup('http://www.google.com')">
</form>

</html>

If this post helps you mark it as answer
Thanks

Rakesh Singh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rakesh Singh on: 4/30/2013 [Member] Starter | Points: 25

Up
0
Down
Dear Satyapriyanayak,

It is open in javascript i knew it,
my question is open popup through c# code when popup block from browser.

Rakesh Singh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response