By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,598 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,598 IT Pros & Developers. It's quick & easy.

onClick event and Pop-Up Blocking Software

P: n/a
Should I expect some of my users to not be able to view a report that I
am launching in a new web browser if they have any popup blocking tool
bars or other software installed on their computer?

<input type="button" value="View MPR For This Location"
onClick="javascript:popUp(''http://MyServer/MPR_Report/ViewReport.aspx?fn=12345'')">

Thanks,
CR Junk

Oct 17 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
"crjunk" <cr****@earthlink.net> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Should I expect some of my users to not be able to view a report that I
am launching in a new web browser if they have any popup blocking tool
bars or other software installed on their computer?

<input type="button" value="View MPR For This Location"
onClick="javascript:popUp(''http://MyServer/MPR_Report/ViewReport.aspx?fn=12
345'')">
Thanks,
CR Junk


Why did you use two apostrophes instead of just one in the function call?
How about just setting "location.href="?

Below are two variations of your approach.
Variation #1: "javascript:" is not required.
Variation #2: uses "location.href=".
<html>
<head>
<title>nopopup.htm</title>
<script type="text/javascript">
function popUp(url) {
alert(url);
}
</script>
</head>
<body>
<form action="" method="get">
<input type="button" value="View MPR For This Location"

onClick="javascript:popUp('http://MyServer/MPR_Report/ViewReport.aspx?fn=123
45')">
<br>
<input type="button" value="View MPR For This Location"
onClick="popUp('http://MyServer/MPR_Report/ViewReport.aspx?fn=12345')">
<br>
<input type="button" value="View MPR For This Location"

onClick="location.href='http://MyServer/MPR_Report/ViewReport.aspx?fn=12345'
">
</form>
</body>
</html>
Oct 17 '05 #2

P: n/a
crjunk said the following on 10/17/2005 2:43 PM:
Should I expect some of my users to not be able to view a report that I
am launching in a new web browser if they have any popup blocking tool
bars or other software installed on their computer?


Absolutely and without a doubt.

Even with user-initiated clicks, you are not always assured of getting
that pop-up window.

Norton's popup blocker is the first that comes to mind. It replaces
window.open with a dummy functions so it *cant* open a new window.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 17 '05 #3

P: n/a
McKirahan said the following on 10/17/2005 2:56 PM:
"crjunk" <cr****@earthlink.net> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Should I expect some of my users to not be able to view a report that I
am launching in a new web browser if they have any popup blocking tool
bars or other software installed on their computer?

<input type="button" value="View MPR For This Location"

onClick="javascript:popUp(''http://MyServer/MPR_Report/ViewReport.aspx?fn=12
345'')">
Thanks,
CR Junk

Why did you use two apostrophes instead of just one in the function call?
How about just setting "location.href="?

Below are two variations of your approach.
Variation #1: "javascript:" is not required.
Variation #2: uses "location.href=".


Neither of which should be considered for a Web site.
<html>
<head>
<title>nopopup.htm</title>
<script type="text/javascript">
function popUp(url) {
alert(url);
}
</script>
</head>
<body>
<form action="" method="get">
<input type="button" value="View MPR For This Location"

onClick="javascript:popUp('http://MyServer/MPR_Report/ViewReport.aspx?fn=123
45')">


javascript: is not needed in any non-IE browser and it is only needed in
IE in a few circumstances. Drop it.

<a href="ViewReport.aspx?fn=12345">The Report with NO Javascript</a>

Why do people try to make things harder than they have to be?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 17 '05 #4

P: n/a
What if I decide not to use any type of javascript?
Does anyone know if using the following standard HTML would be
prevented by a pop-up blocker?
<a target="_blank" href="http://www.google.com">Google</a>

Thanks for everyone's help.

CR Junk

Oct 18 '05 #5

P: n/a
"crjunk" <cr****@earthlink.net> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
What if I decide not to use any type of javascript?
Does anyone know if using the following standard HTML would be
prevented by a pop-up blocker?
<a target="_blank" href="http://www.google.com">Google</a>

Thanks for everyone's help.

CR Junk


It's a hyperlink not a popup so it won't be blocked.
Oct 18 '05 #6

P: n/a
> It's a hyperlink not a popup so it won't be blocked.

By using a hyperlink and not a javascript, do you still have the
ability to remove the address bar and navigational tool bar from the
browser? Everything that I've searched for is using a javascript or the
window.open. I'm not sure what is the "best" solution when opening a
new browser.

I would prefer not having the address bar or toolbars displayed because
the report is automatically loaded as a PDF and I don't want my users
to have problems printing or saving the pdf. It seems like a lot of
the time users will try to use the web browser's "File > Print" or
"File > Save" options instead of using the Acrobat Reader tool bar.

Thanks,
CR Junk

Oct 18 '05 #7

P: n/a
crjunk said the following on 10/18/2005 2:37 PM:
It's a hyperlink not a popup so it won't be blocked.

That depends, directly, on the quality of the popup blocker and the
user's intelligence.

By using a hyperlink and not a javascript, do you still have the
ability to remove the address bar and navigational tool bar from the
browser?
No, but you never had the ability to do that to my browser to begin with.
Everything that I've searched for is using a javascript or the
window.open. I'm not sure what is the "best" solution when opening a
new browser.
The "best" solution is not to do it at all. Let the user decide whether
they want a new window or not. They know better what they want than you do.
I would prefer not having the address bar or toolbars displayed because
the report is automatically loaded as a PDF and I don't want my users
to have problems printing or saving the pdf.
First, it is not "automatically loaded as a PDF" in the browser unless
you have explicit control over every browser that can open the page. It
is a user setting.

It seems like a lot of the time users will try to use the web browser's
"File > Print" or "File > Save" options instead of using the Acrobat
Reader tool bar.


Has it occured to you that maybe they *like* doing it that way?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 18 '05 #8

P: n/a
> The "best" solution is not to do it at all. Let the user decide whether
they want a new window or not. They know better what they want than you do.
Actually, I have to have a new window because if the PDF is loaded in
the user's browser and then the user clicks on the back button, they
will receive a "Warning: Page has Expired " error.
First, it is not "automatically loaded as a PDF" in the browser unless
you have explicit control over every browser that can open the page. It
is a user setting.
This is primarily an intranet application, so for the most part, we can
usually control the browser setting.
Has it occured to you that maybe they *like* doing it that way?


The report is displayed in frames. In the top frame are hyper links to
3 different PDF reports. The bottom panel displays the PDF. If the user
clicks on File > Save, then the browser will try to save the HTML. I
don't want to constantly have phone calls and walk users through the
proper way to save their report.

Thanks,

CR Junk

Oct 19 '05 #9

P: n/a
crjunk said the following on 10/19/2005 9:35 AM:
The "best" solution is not to do it at all. Let the user decide whether
they want a new window or not. They know better what they want than you do.

Actually, I have to have a new window because if the PDF is loaded in
the user's browser and then the user clicks on the back button, they
will receive a "Warning: Page has Expired " error.


Ok, fair enough.
First, it is not "automatically loaded as a PDF" in the browser unless
you have explicit control over every browser that can open the page. It
is a user setting.

This is primarily an intranet application, so for the most part, we can
usually control the browser setting.


Then why can't you "usually control the browser setting" with regards to
popup blockers?
Has it occured to you that maybe they *like* doing it that way?

The report is displayed in frames. In the top frame are hyper links to
3 different PDF reports. The bottom panel displays the PDF. If the user
clicks on File > Save, then the browser will try to save the HTML. I
don't want to constantly have phone calls and walk users through the
proper way to save their report.


<a href="howToSaveTheReports.html">Directions to save Reports</a>

In your top frame.

Educate your users. It will save you many many headaches.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 19 '05 #10

P: n/a
crjunk wrote:
The "best" solution is not to do it at all. Let the user decide whether
they want a new window or not. They know better what they want than you
do.


Actually, I have to have a new window because if the PDF is loaded in
the user's browser and then the user clicks on the back button, they
will receive a "Warning: Page has Expired " error.


So your design decision is merely based on the unfounded assumption
that users have the Adobe Acrobat Reader plugin installed.
PointedEars
--
Alcohol and Math don't mix. So please don't drink and derive!
Oct 20 '05 #11

P: n/a
> So your design decision is merely based on the unfounded assumption
that users have the Adobe Acrobat Reader plugin installed.

My design decision is based on what the boss and my supervisor wants. I
can't always have it my way. He writes the check! :)

Oct 20 '05 #12

P: n/a
Randy Webb said following :
Then why can't you "usually control the browser setting" with regards to popup blockers?

Upper management gets more lenient treatment with what they can and
cannot do on their computer.
<a href="howToSaveTheReports.html">Directions to save Reports</a> In your top frame. Educate your users. It will save you many many headaches.


I'll give that a try. What happens when they don't read the
directions? :) Oh well, can't win them all.

Thanks!
CR Junk

Oct 20 '05 #13

P: n/a
crjunk said the following on 10/20/2005 9:20 AM:
Randy Webb said following :
Then why can't you "usually control the browser setting" with regards to


popup blockers?

Upper management gets more lenient treatment with what they can and
cannot do on their computer.

<a href="howToSaveTheReports.html">Directions to save Reports</a>


In your top frame.


Educate your users. It will save you many many headaches.

I'll give that a try. What happens when they don't read the
directions? :) Oh well, can't win them all.


The same thing that happens when your uppwer management gets lenient
treatment that prevents your "solution" from working otherwise. The
difference is that in the event they don't read the directions, they
call you on the phone and you can say "Open the report page. See the
'Save Reports' link? Read it".

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 20 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.