window.location -- in a blank window....

F

Frances Del Rio

I'm trying to open a url in a new window while pg loads (but NOT in a
pop-up..) I need to do sthg like

// while pg is loading..

window.location ='page.html'
// but I need this to open in a new blank window..
// (NOT in a pop-up, a regular new window..)

can you do this?? thank you..

Frances Del Rio
 
D

David Dorward

Frances said:
I'm trying to open a url in a new window while pg loads (but NOT in a
pop-up..)

That is a contradiction in terms. Opening a URI in a new window IS a popup.
 
G

Grant Wagner

Frances said:
I'm trying to open a url in a new window while pg loads (but NOT in a
pop-up..) I need to do sthg like

// while pg is loading..

window.location ='page.html'
// but I need this to open in a new blank window..
// (NOT in a pop-up, a regular new window..)

can you do this?? thank you..

Frances Del Rio

The only difference between a "popup" and a "new windows" is the name. A
popup is a new window, a new window is a popup.

If you want a new window using JavaScript, just use:

window.open('page.html', 'windowName');

By not specifying a third parameter, you should get a new window with the
default size, position and chrome.
 
F

Frances Del Rio

The only difference between a "popup" and a "new windows" is the name. A
popup is a new window, a new window is a popup.

Excuse me?? there is quite a difference between the two, it seems to me..
a new blank window (opened with a regular <a href="#" target="_blank">)
tag will not be blocked by pop-up blockers... a pop-up window opened
with the window.open() method will.. (apart from other differences,
like for example in a pop-up you can customize how much chrome you
include, in a new blank window you can't.. the way you resize them (you
can resize a new blank window, but it's done differently from how you do
it in a pop-up, where you do it in args in window.open() method..)

at work we use pop-ups for legitimate reasons, not for advertising...
but we've started to come up against pop-up blockers.. I thought we
could open new blank windows instead, which is very simple, except if
you're trying to do window.location upon loading and need this location
to open in a new blank window instead of in same window (the way you
would do in <a href="#" target="_blank"> thank you all for your
response.. still am hoping to find a solution to this problem.. Frances
 
L

Lasse Reichstein Nielsen

Frances Del Rio said:
Excuse me?? there is quite a difference between the two, it seems to me..
a new blank window (opened with a regular <a href="#"
target="_blank">) tag will not be blocked by pop-up blockers... a
pop-up window opened with the window.open() method will..

That dependes on the popup blocker. Some block any new window, no
matter how it was created. Some won't block all script-derived new
windows. Some block windows depending on whether they come from
a user interaction or not.
at work we use pop-ups for legitimate reasons, not for
advertising... but we've started to come up against pop-up blockers..

Fighting against popup-blockers is a losing battle. (That makes it
winning, for us on the other side :)
I thought we could open new blank windows instead, which is very
simple,

So, this should create a "non-popup" popup:

<a href="somelink.html" target="winname" id="foo"></a>
<script type="text/javascript">
document.links['foo'].click();
</script>

My bet at least some popup-blocker will block that too ...

and testing ...

Yes, blocked in Mozilla FireFox. Not blocked in Opera (damn!). No
blocker in IE yet.
except if you're trying to do window.location upon loading and
need this location to open in a new blank window instead of in same
window

Hmm, I don't think I understand what you are trying to do.

/L
 
K

kaeli

[email protected] enlightened said:
Excuse me?? there is quite a difference between the two, it seems to me..
a new blank window (opened with a regular <a href="#" target="_blank">)

That's HTML, not javascript.
And its use is discouraged on the internet. The internet is accessible
by many user agents, not just MSIE browser. ;)
Actually, if you used a strict doctype, you wouldn't be able to use the
target anyway. (You ARE using a doctype, right?)

A popup is any window opened by script, be it javascript or vbscript or
Flash. Unrequested popups are the ones people block most often. That
means they opened without the user clicking on anything or initiating
some event.
A "new window" doesn't even exist in some user agents.

As to blockers, MOST won't block a new window opened as a direct result
of a user click, mouse action, or keypress. Perhaps your functions need
a re-write. You should not be opening unrequested windows. The function
that is fired when the user clicks has to be the one with the open in
it. I've had the most luck doing that, but my main browsers of concern
are Mozilla/Netscape/Firefox/Opera with the option to disallow
unrequested popups. I have not tested that in all the blockers available
for MSIE. Some of them block ALL calls to window.open.

Note that giving something a target in HTML doesn't guarantee it will
open in a new window. I can change that with my browser (mozilla) and
open it in a tab or set it to open in the current window and ignore your
target.

The only way to open a window in javascript is with window.open. There
is no magic other way that won't be blocked.

I have yet to see something that uses popups that truly requires them.

--
 
G

Grant Wagner

Frances said:
Excuse me?? there is quite a difference between the two, it seems to me..
a new blank window (opened with a regular <a href="#" target="_blank">)
tag will not be blocked by pop-up blockers... a pop-up window opened
with the window.open() method will..

No, there is no difference between a new window and a popup.

There is a difference between a window opened by the browser as a result of
specifying a TARGET attribute on an <A> tag and a window opened
programmatically using client-side JavaScript.

There is even a difference between programmatically opened windows that were
opened as the result of some user action (such as clicking a link) and
programmatically opened windows which opened as the result of event beyond the
user's control (such as the page loading). In some cases a "popup blocker"
will block the latter, but not the former, in other cases, a "popup blocker"
considers them both unacceptable.

As for myself, my "popup blocking mechanism" even considers <a href="..."
target="_blank"> unacceptable and refuses to open such links in a new window
unless I specifically allow it.
at work we use pop-ups for legitimate reasons, not for advertising...
but we've started to come up against pop-up blockers.. I thought we
could open new blank windows instead, which is very simple, except if
you're trying to do window.location upon loading and need this location
to open in a new blank window instead of in same window (the way you
would do in <a href="#" target="_blank"> thank you all for your
response.. still am hoping to find a solution to this problem.. Frances

As has already been discussed, there is no solution. Stop using
programmatically opened windows. Or stop using code that opens new windows
without the user explicitly requesting one (which will get you past some, but
not all "popup blockers"). Ultimately you will have to abandon any attempt to
control your users' desktops, so you may as well start now instead of trying
to find a bubblegum and paperclip solution to the problem.
 
R

Richard Cornford

Frances said:
Excuse me?? there is quite a difference between the two, it seems
to me.. a new blank window (opened with a regular <a href="#"
target="_blank">) tag will not be blocked by pop-up blockers...
a pop-up window opened with the window.open() method will..
<snip>

The last resort of those that will not abandon the practice of
attempting to open new windows is to appeal to the notion of the
"requested" pop-up. Unfortunately different pop-up blocking mechanisms
have different notions of what is to be considered "requested" and some
make no distinction at all:-

<URL: http://www.litotes.demon.co.uk/js_info/pop_ups.html >

Richard.
 
F

Frances Del Rio

ok, I thank everyone for their comments/feedback... but I'd like to say
that where I work, we're an internet co. that mainly produces webcasts
for Fortune 500 cos., trade associations, some non-profits... we use
pop-ups for the video displays, we open a window that's approx 790x530,
on the left side is the video, on the right images that flip (or are
flipped by user) as video progresses.. this is a perfectly legitimate
use of pop-up windows.. there's no way we can do this in same window
where users register, login, etc (that has a nav frame on the left and
on main frame pgs for registration, login, etc..) if you go to
www.foxnews.com and scroll down to where it says "News 24/7" and click
on a video link you will see what I mean.. our media viewer windows are
more or less the same size, and have a similar layout (ours look better,
though.. ;) and of course they have no advertising..)

so: yes, it IS a drag that advertisers are abusing this function,
because I personally find pop-ups really neat, I think you can design
good UI w/them if you use them right.. I have been doing HTML for about
10 years now, and have used them a lot in my personal website also
(www.francesdelrio.com) (& practically all of them are opened by user..)

and the thing is, going back to my situation at work, if a user goes to
main page and our sw detects this user is already registered and we have
their password stored or whatever this video viewer pops up
automatically, w/out any input from user, while pg is still loading in
many cases.. this is where the problem arises.. so I came up w/idea
that instead of a pop-up opened w/window.open() method we could open the
video viewer in a regular new blank window, <a href="__"
target="_blank"> and resize... but how do you do this while page is
loading (w/o input from user??)

ok, I think I've written enough for now... ;)

Frances
 
L

Lasse Reichstein Nielsen

Frances Del Rio said:
so I came up w/idea that instead of a pop-up opened w/window.open()
method we could open the video viewer in a regular new blank window,
<a href="__" target="_blank"> and resize... but how do you do this
while page is loading (w/o input from user??)

You can *try*:

<a href="..." target="_blank" id="foo"></a>
<script type="text/javascript">
document.links['foo'].click();
</script>


Won't work in all browsers, though.
/L
 
T

Thomas 'PointedEars' Lahn

Frances said:
ok, I thank everyone for their comments/feedback... but I'd like to say
that where I work, we're an internet co. that mainly produces webcasts
for Fortune 500 cos., trade associations, some non-profits... we use
pop-ups for the video displays, we open a window that's approx 790x530,

What if the user has a desktop size that does not allow such large windows
to be opened?
on the left side is the video, on the right images that flip (or are
flipped by user) as video progresses.. this is a perfectly legitimate
use of pop-up windows..

No, it is not. Pop-ups are a Bad Thing. They eat much more resources than
required if abandoned.
there's no way we can do this in same window where users register, login,

There is. You are obviously not competent enough to make design decisions.
Get yourself educated.
etc (that has a nav frame on the left and on main frame pgs for
registration, login, etc..)

Frames are a Bad Thing. Use CSS and fixed layers instead.
This even works in IE with a small workaround.
if you go to www.foxnews.com and scroll down to where it says
"News 24/7" and click on a video link you will see what I mean..

Doing Bad Things just because others do Bad Things has never been
a reasonable excuse, if that.
[more incompetent blabla]

What you like or dislike is irrelevant. If you design/hack for a
customer, what the customer wants when it comes to such design
decisions should be irrelevant (and it is your job to explain why).
Functionality is relevant. The fish must eat the worm, not the
fisher.
and the thing is, going back to my situation at work, if a user goes to
main page and our sw detects this user is already registered and we have
their password stored or whatever this video viewer pops up
automatically, w/out any input from user, while pg is still loading in
many cases.. this is where the problem arises..

The problem arises *at least* with Windows XP Service Pack 2
which finally causes the (alas!) most used browser today to
block unrequested popups *by default*.
[...]
ok, I think I've written enough for now... ;)
[...]

And if you would saved us from that top-post, too, as strongly
recommended in the FAQ, it would be more appreciated.


PointedEars
 
K

kaeli

[email protected] enlightened us said:
ok, I thank everyone for their comments/feedback... but I'd like to say
that where I work, we're an internet co. that mainly produces webcasts
for Fortune 500 cos., trade associations, some non-profits... we use
pop-ups for the video displays, we open a window that's approx 790x530,
on the left side is the video, on the right images that flip (or are
flipped by user) as video progresses.. this is a perfectly legitimate
use of pop-up windows..

Yes, it is, and it's used by a lot of multimedia and game sites, all of which
(from what I've noticed, anyway) have a disclaimer that effectively tells
people that they use popups and to turn off their blocker or control+click
(for some blockers) to allow the popups. :)
Heck, my favorite game spot uses popups and applets, two things I usually
tell people NOT to use. *smile*
If your content is worth it, you tell users about it and they'll decide they
like you enough to turn off blocking for you.

All blockers have a way to allow popups by some means. Some are
control+click, some you have to add the site to a list of allowed sites, etc.

There really isn't a good way around this issue. You just have to inform the
user about it and let them decide if they want to use your site by turning
off popup blocking or not.

My two cents...

--
 
G

Grant Wagner

Andrew said:
Cool. I had previously rejected any attempt
(by the system) to update.. But that one is
*worth* it! I hit a page the other day that
had 2 pop-ups and 3 pop-unders.. :-O

Use a Gecko-based browser and get popup blocking built-in. Or if you
must use IE, install the Google toolbar <url: http://toolbar.google.com/
/>. It blocks most (but not all) popups.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top