Solved

browser detection

Posted on 2004-08-25
11
623 Views
Last Modified: 2012-05-05
i am using ASP to develop web application..

so, if i wana detect the browser, i know i can do it by using HTTP_USER_AGENT, or even navigator.appName in javascript or Browser component..

but, if i wana detect if the user's browser will blocked all pop up window???

like if in my code hav window.open(..) in page onload..

i cant execute this code if user's browser block popup window..

how do i detect browser with blocked pop up window???

thanx for help..
0
Comment
Question by:lenz8as
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 5

Expert Comment

by:cristy56
ID: 11890278
I don't think you can detect that.
Just think if u can detect some customized settings in the client side and modify it, it will be very insecure.

Cristy
0
 

Author Comment

by:lenz8as
ID: 11890419
t if i use pop up blocker, when in onload, i try execute window.open(...), it cant be done.. cant open new window..

but when i use a link, like when user click a button, then just execute window.open(...), script will be executed...

y??? who know how pop up blocker detect  user action wheter a user click a button to open new window or the application open new window without user interaction...
0
 
LVL 1

Expert Comment

by:John-Doe
ID: 11890785
Since the popup are done clientside you have to detect wether popup-block are active clientside.

This can then be checked with ie JavaScript:

Ex1:

<script language="JavaScript" type="text/javascript">

var popupWindow=false;

popupWindow = window.open("http://somurl.com");

if(popupWindow){
  // The popup has not ben blocked do what ever
}else{
  // The popup has been blocked , do whatever.
}

</script>

If you need this information serverside you could ie create a form and set a value like bloc=true or false and post it to the actual page you wanna show.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:John-Doe
ID: 11890952
Ok... can always give an example of "need it serverside"
This can of course be modified to be better, but the basic are.

<html>

<head>
  <title>PopUp Check Window - Redirect</title>
</head>

<body>

<form id="blockdetect" action="page2.asp" method="POST">
  <input type="hidden" id="pblock" name="pblock" value="not_blocked">
</form>

</body>

<script language="JavaScript" type="text/javascript">

var popupWindow=false;

popupWindow = window.open("about:blank");

if(!popupWindow){
  document.getElementById("pblock").value='blocked';
}

popupWindow.close();

document.all.blockdetect.submit();

</script>

</html>
0
 

Author Comment

by:lenz8as
ID: 11898812
John_Doe..
i have try ur suggestion.. but stil cant..
because when execute

popupWindow=window.open(..)

if the user's browser have pop up blocker, this statement still return an object..
so the statement

if(!popWindow){}
will not be executed ...

anyway, thanx... anyone can help me??
0
 
LVL 1

Expert Comment

by:John-Doe
ID: 11899490
Ok, - did not test it...

What about this then:

1. Do not open about:blank, but a document that has a input with a value.
2. Check the value (if you got it)
3. Post

Ie:

Main File:

<html>

<head>
  <title>PopUp Check Window - Redirect</title>
</head>

<body>

<form id="blockdetect" action="page2.asp" method="POST">
  <input type="hidden" id="pblock" name="pblock" value="not_blocked">
</form>

</body>

<script language="JavaScript" type="text/javascript">

var popupWindow=false;
var areOpen=false;

popupWindow = window.open("someDoc.html");

var areOpen = popupWindow.document.getElementById('pblock').value;

if(!areOpen){
  document.getElementById("pblock").value='blocked';
}

popupWindow.close();

document.all.blockdetect.submit();

</script>

</html>

File 2(someDoc.html)

<html>
  <input type="hidden" id="pblock" name="pblock" value="true">
</html>
0
 
LVL 1

Expert Comment

by:John-Doe
ID: 11899492
else, . i have no idea - might possible to get some more information from the popupWindow [object]..?
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 80 total points
ID: 11902618
lenz8as,

Perhaps it is time you realized that users do not like popups.  Users are going to block popups, and even if someone comes up with a way to detect the blocked popup, the manufactures will find a way to prevent detection.  Because users do not want your popup stuck in their face.  So my advice to you would be to get rid of the popup and present whatever you are forcing on the user in a way that is more acceptable.

Quite frankly, if someone did have a solution for you, I would immediately start to work on code to prevent their solution from working and I would make it available for free, because I cannot think of a single situation where an unsolicited popup is necessary; and they have become to most abusive form of delivery on the Internet.  I urge you to put your efforts into improving your content so it does not need popups; instead of wasting your energy trying to impose your will on the users.

Cd&
0
 
LVL 1

Expert Comment

by:John-Doe
ID: 11913592
Agree that popup are a real pain - and I never use it for any solutions myself.

If the question was how to force popup or similar, I would never applied any suggestions.

However there are several occasions where detecting if user have a popup-blocker can be of some use for “legal” reasons.

Have used several systems developed for customer care and similar where they use popup to i.e. give the users choices that in turn are sent back to the opener page. And lot’s of other popup functionalities like process bars where code in popup do processes server side and so forth.

As mentioned I never use this sort of solutions myself, but one can be set to do minor changes in systems using this – and instead of saying “you have to enable popup to work this page” one can instead give other solutions for the user..

Br,
  -JD
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 11921768
Nothing you mentions there requires an unsolicited popup.  Thre are all kinds of alternatives to unsolicted popups, not the least of which is to launch the popup when teh user requsts it, but there are frames( including hidden frames), iframes, layers, and even continuous streaming using XMLHTTP.  None of which are disreputable enough that user demands have spawned a whole whack of products designed to prevent them from functioning.  

Popup blockers exist because 99% of popups are nothing less than abusvie and anything else that violates users rights with suffer the same fate.  Thank God for consumer activism, that keeps abuse in check.

Cd&
0
 
LVL 1

Expert Comment

by:John-Doe
ID: 11921821
Well - as i said i never uses it myself but find other solutions.

What i meant was there are existing - in production - already made - coded by others - up running -.. or what ever ie Customer Care system using pop-up.
Of course the coders behind the existing system could have made better solution - but that's not always the fact.

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question