473,549 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.open() Not Opening in Same Window All The Time

Hi All,

I'm having a problem that is driving me absolutely batty and I'm hoping
that one of you JavaScript gurus can help me out before I go stark
raving mad.

I am using the function shown below to open links into the same pop-up
window each time a user clicks any of the news story links contained in
http://www.kris.ca/newsroom.aspx. The function works perfectly for all
of the links except for the ones from the BBC's website. Links to
stories from the BBC's website insist on opening in a new popup window
each time no matter what I do. This behaviour is consistent in both IE
and Firefox.

The behaviour makes absolutely no sense to me as all of the links use
the same function call. Any ideas?
function popupfeed(url) {
var myfeatures =
"toolbar=no,loc ation=no,direct ories=no,menuba r=yes,scrollbar s=yes,status=ye s,resizable=yes ,width=800,heig ht=600";

thefeed = window.open( url, 'feed2jspop', myfeatures);
if (window.focus) {thefeed.focus( )}
}

Apr 14 '06 #1
5 5391
k.************* @gmail.com wrote:
Hi All,

I'm having a problem that is driving me absolutely batty and I'm hoping
that one of you JavaScript gurus can help me out before I go stark
raving mad.

I am using the function shown below to open links into the same pop-up
window each time a user clicks any of the news story links contained in
http://www.kris.ca/newsroom.aspx. The function works perfectly for all
of the links except for the ones from the BBC's website. Links to
stories from the BBC's website insist on opening in a new popup window
each time no matter what I do. This behaviour is consistent in both IE
and Firefox.


You say this works fine on all other links? That would lead me to
suspect the BBC site instead - perhaps they have some sort of code that
opens the new popup?
Apr 14 '06 #2
Thank you for the response Tony. That thought had occurred to me as
well but wouldn't that cause two pop-ups then - one from my code and
another from theirs?

Apr 15 '06 #3
k.************* @gmail.com wrote:
Hi All,

I'm having a problem that is driving me absolutely batty and I'm hoping
that one of you JavaScript gurus can help me out before I go stark
raving mad.

I am using the function shown below to open links into the same pop-up
window each time a user clicks any of the news story links contained in
http://www.kris.ca/newsroom.aspx. The function works perfectly for all
of the links except for the ones from the BBC's website. Links to
stories from the BBC's website insist on opening in a new popup window
each time no matter what I do. This behaviour is consistent in both IE
and Firefox.

The behaviour makes absolutely no sense to me as all of the links use
the same function call. Any ideas?
function popupfeed(url) {
var myfeatures =
"toolbar=no,loc ation=no,direct ories=no,menuba r=yes,scrollbar s=yes,status=ye s,resizable=yes ,width=800,heig ht=600";

thefeed = window.open( url, 'feed2jspop', myfeatures);
if (window.focus) {thefeed.focus( )}
}


Try instead:

// Declare window name as a global variable
var feedWindow;

function popupfeed(url)
{

// Open window only if not already open
if (!feedWindow || feedWindow.clos ed){

// Just include the features you want, the others will be
// off by default (if permitted by browser settings)
var popfeatures =
"menubar,scroll bars,status,res izable,width=80 0,height=600";

feedWindow = window.open('', 'feed2jspop','p opfeatures');
}

// Set the location
feedWindow.loca tion = url;

// Give it focus
if (feedWindow.foc us) feedWindow.focu s();

// Allow onclick to stop navigation if A element used
return !feedWindow;
}
Read the stuff here:

<URL:http://developer.mozil la.org/en/docs/DOM:window.open >

--
Rob
Apr 15 '06 #4
Thank you for the response RobG. Your solution worked like a charm
except that I couldn't I couldn't get the scroll bars to appear ...
which presents a problem if the news story doesn't fit in the 800 x 600
window. Any ideas?

Apr 18 '06 #5
Please disregard my previous reply ... I got the scroll bars working
now ... stupid typo on my part. :)

The solution is working 99% of the time now but it still opens new
windows occasionally. It's very bizarre, but it seems that a new window
is opened each time you transition from the BBC's news stories to news
stories from any other source. For example, if I display stories from
the BBC, I can click to my hearts content and the stories will stay in
the same pop-up. If, however, the pop-up is open and it contains a
story from the BBC and I try to display a story from any other source
(ABC News for example), the story will open a brand new pop-up. Very
odd to say the least!

Is it possible that the BBC's page contains some javascript that
detects when the window is navigating to a different domain? If so, is
there anyway that I can disable javascript for the link that I am
opening?

Apr 18 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
9415
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to intercept the key so that I can do stuff on the server side to make the new window behave correctly? (We have a JSP-based webapp which stores state in...
10
11200
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#" onClick="window.open('/cgi-bin/displayimage.cgi?/store/demo/image.jpg&YOUR+PRODUCT%27<b>S+NAME+GOES', 'fullimage', 'WIDTH=420,HEIGHT=405,status=0')"> The original window should not reload, but...
10
6715
by: David McCulloch | last post by:
The following code opens a new window, but the "resizeTo" doesn't resize it. Why not? (Don't ask why I simply did not open the window with the new size....my original problem was how to open a new window with maximized dimensions!) FYI, I uploaded the same code to: http://tosasoft.com/test/open.htm ...
17
2498
by: Applebrownbetty | last post by:
Hi, I'd like to append/amend the following code from the Dreamweaver extension "Open Picture Window Fever" for the ability to center the PopUp window: By default, it allows the window to be offset on the left and top, but does not include a centering option. I'm thinking it would include something like (screen.width-imageWidth)/2;...
14
11034
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin =...
18
2480
by: Roger Withnell | last post by:
I open a new window from the current window to display maps. Several maps of different sizes can be displayed. The function is given the size of the map and adjusts the window size accordingly. If a new window is already open, the new map sizes are ignored and the new map is is either too small for the existing "new" window or too big,...
4
3220
by: arajunk | last post by:
In Firefox this opens a full size window (maximized) . In IE it opens the partial window requiring user to click restore (upper right) to maximize. What am I missing ? var infoWindow=window.open('usgsMain.html','USGSwindow','status=no,resizable=yes,scrollbars=yes');
3
10214
by: Andrew Poulos | last post by:
There's a HTA application that's running on a local computer (not from a URL) and the user can open a new HTML window by clicking a button The first time the user clicks the button the window opens. Any subsequent click causes this dialog, with this error, to appear: "Error: The remote server machine does not exist or is unavailable" ...
6
2064
by: SAL | last post by:
Hi, VS2005 post I'm opening a window using the following syntax: Protected Sub lbEstValue_Click(ByVal sender As Object, ByVal e As System.EventArgs) Response.Write("<script>window.open('EstValueHelp.aspx','_help', 'width=400,height=400');</script>") End Sub
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.