Redirectiing low resolution views to open a new browser window

J

Jim Van Abbema

I have a frames site that uses several pages subcontracted and operated from
another site. At 1024 x 768 these pages fit well within the frames, but at
800 x 600 and lower they require their own browser windows. I am using the
following script to detect screen resolution and redirect viewers:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
var url640x480 = "http://example.com/example";
var url800x600 = "http://example.com/example";
var url1024x768 = "http://example.come/example";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else window.location.href= url640x480;
}
// End -->
</script>

How could I modify this or another script to force the 640x480 and 800x600
pages to open in a new browser window? Inserting target="_blank" with the
URL does not work!

Thanks,
Jim Van Abbema
 
K

Kris

Jim Van Abbema said:
How could I modify this or another script to force

"force" does not compute on the WWW. Consider using a more flexible
layout. Google helps you find more on 'liquid design'. Cherish it, many
people have been flamed to death getting this info out.
 
J

Jim Van Abbema

Sorry Kris,

If I was able access and redesign the remote pages, I would do so (they were
originally designed to operate in their own windows, but the powers that be
would like them to function within our frames when it's feasible to do so).
I only want to detect the low resolution viewers and have them view these
pages in a new browser window.

Jim
 
K

Kris

Jim Van Abbema said:
If I was able access and redesign the remote pages, I would do so (they were
originally designed to operate in their own windows, but the powers that be
would like them to function within our frames when it's feasible to do so).
I only want to detect the low resolution viewers and have them view these
pages in a new browser window.

In one frame, where you supply navigational links, you can use
target="nameOfMainFrame" (whatever the main frame's name is) and have a
link "On a low screen resolution? (<800x600)" to an alternative
navigation that uses target="_blank" on all links.

Is this perhaps a solution?
 
J

Jim Van Abbema

Kris said:
In one frame, where you supply navigational links, you can use
target="nameOfMainFrame" (whatever the main frame's name is) and have a
link "On a low screen resolution? (<800x600)" to an alternative
navigation that uses target="_blank" on all links.

Is this perhaps a solution?


Hi Kris,

Unfortunately, I had already thought of that as a solution (using a
navigation frame that carries the lowres link and one without), but the link
to these pages exists not only in the navigation frame but also on two other
frequently modified pages... which means that whenever I update these pages
I would have to create two versions (one with the lowres link, one without)
of each of these pages. What a pain! That's why I was seeking a JavaScript
solution.

Jim
 
K

Kris

In one frame, where you supply navigational links, you can use
target="nameOfMainFrame" (whatever the main frame's name is) and have a
link "On a low screen resolution? (<800x600)" to an alternative
navigation that uses target="_blank" on all links.

Is this perhaps a solution?
[/QUOTE]
Unfortunately, I had already thought of that as a solution (using a
navigation frame that carries the lowres link and one without), but the link
to these pages exists not only in the navigation frame but also on two other
frequently modified pages... which means that whenever I update these pages
I would have to create two versions (one with the lowres link, one without)
of each of these pages. What a pain! That's why I was seeking a JavaScript
solution.

Hmm... a total of 3 extra pages instead of only one? That is not so much
of a pain, considering the crippling situation the frames and the
out-of-your-control website already cause you. It is more robust and
easier to create than a javascript solution (which will only work
sometimes).

You should make a big note though, letting all involved know that one
has to update all pages when necessary.
 
G

Grahammer

What about those running 600x800? (Ya, I do it) How about 1152x864?

Just design your site to maximize the use of the window (ie, don't put a big
menu on the left side that reduces space by 15% - put a SMALL menu at the
TOP of the page) and let the scroll bars do the work like they are supposed
to when a page doesn't fit.
 
M

Mark Parnell

I have a frames site

http://html-faq.com/htmlframes/?framesareevil
http://homepage.ntlworld.com/l_vajzovic/tom/web/frames.html
http://dorward.me.uk/www/frames/
http://www.google.com/webmasters/2.html (see under "Your page uses
frames")
that uses several pages subcontracted and operated from another site.

I assume you have their permission? It's a breach of copyright
otherwise.
At 1024 x 768 these pages fit well within the frames, but at
800 x 600 and lower they require their own browser windows.

Then your design is broken. Fix it.
http://www.allmyfaqs.com/faq.pl?AnySizeDesign
I am using the following script to detect screen resolution and redirect
viewers:

As brucie said, there is no reliable way to detect screen resolution (if
nothing else, what of those without Javascript?), and resolution is
irrelevant when we are talking about the available canvas for your site.
How could I modify this or another script to force
http://www.allmyfaqs.com/faq.pl?How_do_I_force
http://webtips.dan.info/force.html

the 640x480 and 800x600 pages to open in a new browser window?

You can't. If I want something to open in a new browser window, I'll do
it myself. It's my browser, not yours.
Inserting target="_blank" with the URL does not work!

It never will. My browser blocks popup windows.
 
J

Jeff Thies

Jim Van Abbema said:
I have a frames site that uses several pages subcontracted and operated from
another site. At 1024 x 768 these pages fit well within the frames, but at
800 x 600 and lower they require their own browser windows. I am using the
following script to detect screen resolution and redirect viewers:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
var url640x480 = "http://example.com/example";
var url800x600 = "http://example.com/example";
var url1024x768 = "http://example.come/example";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else window.location.href= url640x480;
}
// End -->
</script>

For the time, forget that you shouldn't be doing that.

That's terrible code. It's IE specific and makes no provision for what the
users window width actually is. Many people with screen resolution 1024 and
up do not browse maximized.
How could I modify this or another script to force the 640x480 and 800x600
pages to open in a new browser window? Inserting target="_blank" with the
URL does not work!

Remember those popup windows most people have grown to hate and block.
You'll need to make one to do that. Look up window.open. Better yet read the
FAQ in comp.lang.javascript.

Jeff
 

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,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top