The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Trying to debug a little problem that has to do with making a new window., Um, I don't want links to open in a new tab in popup window. (Fire
Elizara
post Dec 26 2007, 12:27 PM
Post #1





Group: Members
Posts: 1
Joined: 26-December 07
Member No.: 4,585



Once upon a time, a friend of mine along with me got a very nice Javascript to open windows with a click of a mouse. He may of gotten it somewhere, I don't know.

I use it a lot on this site: http://maryadavies.250free.com/rpgamerboard (I'll list out the code in a second)

The only problem is; for links to outside sites in said window, I've always used target=blank in the links. With tabbed browsers, THAT opens a new tab. (Which in a little window, does not look very nice.) I'd either like that to 1. Open said sites in first window in new tab or 2. Open in whole new window.

Is there something I can change in the HTML or a Javascript I can add to the files to force a new window or put it in first window? Thank you.


As for the java script:

(In head of document)

<script type="text/javascript">
function popup(url,popup_w,popup_h)
{
// (url,height,width)
var popup = "height=" + popup_h + ",width=" + popup_w + ",scrollbars=yes";
window.open(url,"",popup);
}
</script>

At link:

<a href="java script:popup('fileforpopup.html',width, height)">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 26 2007, 01:16 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,734
Joined: 9-August 06
Member No.: 6



QUOTE
Is there something I can change in the HTML or a Javascript I can add to the files to force a new window or put it in first window?

You can't control if the page opens in a new window or a new tab, as that is a browser setting.

You can, with JavaScript, ensure the page opens in the window that opened the popup. You refer to that window with 'opener'.

CODE
opener.location.href = '[URL]';
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Dec 26 2007, 02:57 PM
Post #3


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



CODE
<a href="fileforpopup.html">
would avoid the problem by letting the user decide whether to open the link in the same window, in a new window, or in a new tab.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th May 2024 - 05:40 PM