Solved

browser detection

Posted on 2004-08-25
11
613 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
  • 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now