473,732 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

popup open problem only with firefox

Hi,

i have this problem:

Sometimes, i can't reproduce, if i click on an small image on the
website, the popup _AND_ an other Tab in firefox open.

Here are the linkcode:

<div align="center">
<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"
onclick="popup( this, 850, 800); return false" target="_blank" ><img
class="newspic_ click" src="/newspics/p4_7ghz_memesam a.jpg" alt="Bild"
title="Zum vergrößern klicken"></a>
</div>

Where? http://www.tweakpc.de/?news_id=8100 here for example

Why can this happen ? I have tried a lot, but nothing works.

--
Markus K.

Aug 11 '05 #1
23 6409
ASM
Markus wrote:
Hi,

i have this problem:

Sometimes, i can't reproduce, if i click on an small image on the
website, the popup _AND_ an other Tab in firefox open.
your code in my FF (where I allow to open popups send from links)
open two new blank pages ... ! (and no other tab)
one naked and one complete
Here are the linkcode:

<div align="center">
<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"
onclick="popup( this, 850, 800); return false" target="_blank" ><img
class="newspic_ click" src="/newspics/p4_7ghz_memesam a.jpg" alt="Bild"
title="Zum vergrößern klicken"></a>
</div>
what does exactly your function popup() ?
what is 'this' for the function popup() in :
onclick="popup( this, 850, 800); ?
Where? http://www.tweakpc.de/?news_id=8100 here for example

Why can this happen ? I have tried a lot, but nothing works.


function popup(lnk,wiz,h igt) {
here=window.ope n(lnk.href,'her e','width='+wiz +',height='+hig t+',resizable=1 ');
//------------------------^----^ here = the target
}

<a href="big.jpg" target="here" onclick="popup( this,850,screen .height-40)">

will open the page hrefered in links in a new naked window targeted
with same name as called in link ( target -> 'here' )
So ... no need of 'return false'

If JS is disabled, that will open a blank standard window

If popups are disabled in FF, I hope that it will open a new tab ... (?)

--
Stephane Moriaux et son [moins] vieux Mac
Aug 11 '05 #2
ASM wrote:
your code in my FF (where I allow to open popups send from links)
open two new blank pages ... ! (and no other tab)
one naked and one complete
Did you checked the link i posted in my first entry ? There is link to
a news with a small image that can be enlarged by clicking the picture.
What happend on your PC?
Here are the linkcode:

<div align="center">
<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"
onclick="popup( this, 850, 800); return false" target="_blank" ><img
class="newspic_ click" src="/newspics/p4_7ghz_memesam a.jpg" alt="Bild"
title="Zum vergrößern klicken"></a>
</div>


what does exactly your function popup() ?
what is 'this' for the function popup() in :
onclick="popup( this, 850, 800); ?


ok i forgot to insert the hole Script. Here it is:

function popup(element, width, height) {
if (element.getAtt ribute) {
url = element.getAttr ibute('href');
} else {
url = element;
}
new_window = window.open(url , '_blank', 'width=' + width + ', height='
+ height + ', left=' + Math.round((scr een.width - width)/2) + ', top='
+ Math.round((scr een.height - height)/4) + ', location=0, statusbar=0,
menubar=0, toolbar=0, scrollbars=1, resizable=yes') ;
}

If Javascript is enabled it should be there one new window with witdh
of 850 and height of 800. And if javascript disabled the big picture
should be open in an fresh ne window (target="_blank ").
<a href="big.jpg" target="here" onclick="popup( this,850,screen .height-40)">

will open the page hrefered in links in a new naked window targeted
with same name as called in link ( target -> 'here' )
So ... no need of 'return false' Dont understand ? the part _return false_ is used if javascript is
enabled to prevent the browser to open the new site in an extra new
full window.
If JS is disabled, that will open a blank standard window

yes.

Ok i hope now its clear.

Aug 12 '05 #3
ASM
Markus wrote:

Did you checked the link i posted in my first entry ?
I did this :
http://www.tweakpc.de/?news_id=8100
link :
<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"
onclick="popup( this, 900, 800); return false" target="_blank" ><img
class="newspic_ click" src="/newspics/p4_7ghz_memesam a.jpg" alt="Bild"
title="Zum vergr&ouml;&szl ig;ern klicken" /></a>
What happend on your PC?
I have a Mac :-/
and obtain 2 new windows (with big jpg and some moving decorations)
one in "normal" blank
other by window.open()
ok i forgot to insert the hole Script. Here it is:

function popup(element, width, height) {
if (element.getAtt ribute) {
url = element.getAttr ibute('href');
} else {
url = element;
}
new_window = window.open(url , '_blank', 'width=' + width + ', height='
+ height + ', left=' + Math.round((scr een.width - width)/2) + ', top='
+ Math.round((scr een.height - height)/4) + ', location=0, statusbar=0,
menubar=0, toolbar=0, scrollbars=1, resizable=yes') ;
}
it is status and not statusbar
try to do not have spaces in the attributes of window.open()
If Javascript is enabled it should be there one new window with witdh
of 850 and height of 800. And if javascript disabled the big picture
should be open in an fresh ne window (target="_blank ").
It seems it would have to ...
Perhaps, if you could try giving same target (as you do)
- to the link
- to the window.open()
but with a real name insteed of "_blank" (i.e : "somewhere" )

It also would be interresting you see what exactly does :
screenshot?show =
with same name as called in link ( target -> 'here' )
So ... no need of 'return false'


Dont understand ? the part _return false_ is used if javascript is
enabled to prevent the browser to open the new site in an extra new
full window.


Yes usualy, but you use "_blank" as target in your popup ...
try without target in your popup function :
new_window = window.open(ele ment.href,'',' blah blah ');

and ... I made a mistake :
to do not have blank window AND popup you would have to do :

function popup(width,hei ght) {
new_window = window.open('', 'truc','width=' + width + ',height='
+ height + ', left=' + Math.round((scr een.width - width)/2) + ',top='
+ Math.round((scr een.height - height)/4) +
',location=0,st atus=0,menubar= 0,toolbar=0,scr ollbars=1,resiz able=1');
}

and your link would have to be :

<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"

target="truc"

onclick="popup( 850,800)"><img src=" ...></a>

If JS is disabled, that will open a blank standard window

Ok i hope now its clear.


your post was clear

the JS result of your link not too much :-/

my example (based on your JS) is here :
http://perso.wanadoo.fr/stephane.moriaux/truc/popup.htm
(it works fine with my FF)

--
Stephane Moriaux et son [moins] vieux Mac
Aug 12 '05 #4
ASM wrote:
I have a Mac :-/ sorry! ;) I forgot to check it on my one. Primary i use a pc.
It also would be interresting you see what exactly does :
screenshot?show = This php file only build the entire popup website with the image of the
php paramter.
to do not have blank window AND popup you would have to do :

function popup(width,hei ght) {
new_window = window.open('', 'truc','width=' + width + ',height='
+ height + ', left=' + Math.round((scr een.width - width)/2) + ',top='
+ Math.round((scr een.height - height)/4) +
',location=0,st atus=0,menubar= 0,toolbar=0,scr ollbars=1,resiz able=1');
}

and your link would have to be :

<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"

target="truc"

onclick="popup( 850,800)"><img src=" ...></a>
if (element.getAtt ribute) {
url = element.getAttr ibute('href');
} else {
url = element;
}


GREAT it works!, but what happened to my elemt.get... code ? Can't
understand why there is no need for. How the browser know, witch File
he have to open ?
my example (based on your JS) is here :
http://perso.wanadoo.fr/stephane.moriaux/truc/popup.htm
(it works fine with my FF)


Thank you very much! Wow what a result of a long day. Just entered the
google-groups and posted a question, and hours later i have the answer
i searching since days :)
ok gn8 (4:15 am)

Aug 12 '05 #5
There is one probleme now: It don't work with IE :(. Now, i have to
find a solution.

Aug 12 '05 #6
Markus wrote:
There is one probleme now: It don't work with IE :(. Now, i have to
find a solution.

Read the thread here:

<URL:http://groups-beta.google.com/group/comp.lang.javas cript/browse_frm/thread/caf4e95379da303 f/819e9b8f438e7fa a?q=target%3D_b lank+opens+two& rnum=1&hl=en#81 9e9b8f438e7faa>

--
Rob
Aug 12 '05 #7
Markus a écrit :
ASM wrote:

your code in my FF (where I allow to open popups send from links)
open two new blank pages ... ! (and no other tab)
one naked and one complete

Did you checked the link i posted in my first entry ? There is link to
a news with a small image that can be enlarged by clicking the picture.
What happend on your PC?

Here are the linkcode:

<div align="center">
<a href="/screenshot?show =p4_7ghz_memesa ma_big.jpg"
onclick="pop up(this, 850, 800); return false" target="_blank" >
You can avoid the forking in the popup function by making
onclick="popup( this.href, 850, 800); return false;"
instead

<imgclass="newsp ic_click" src="/newspics/p4_7ghz_memesam a.jpg" alt="Bild"
title="Zum vergrößern klicken"></a>
</div>


what does exactly your function popup() ?
what is 'this' for the function popup() in :
onclick="popup( this, 850, 800); ?

ok i forgot to insert the hole Script. Here it is:

function popup(element, width, height) {
if (element.getAtt ribute) {
url = element.getAttr ibute('href');
} else {
url = element;
}
new_window = window.open(url , '_blank', 'width=' + width + ', height='
+ height + ', left=' + Math.round((scr een.width - width)/2) + ', top='
+ Math.round((scr een.height - height)/4) + ', location=0, statusbar=0,
menubar=0, toolbar=0, scrollbars=1, resizable=yes') ;

1- new_window should be properly declared as a global variable
2- you can replace '_blank' with a parameter transferring, copying the
target attribute value. This makes your function better parameterized,
reusable.
3- there must not be any blank space in the windowFeatures string list.
Here, you have one between each of the commas and the following name of
the windowFeature. This will break in Firefox and other Mozilla-based
browsers.
4- because of your blank spaces, scrollbars and resizable requests of
the window.open() call will be ignored
5- You request an height of 800px: that will fail in a very wide
majority of cases because a majority of 1024x768 users have about 660px
or less of available space for a window. So not only the window's top
will be reset by Mozilla/Firefox compensating positioning code, but your
window will not be 800 either.
6- do not use screen.width in any of your calculation; use
screen.availWid th and screen.availHei ght since you have no idea of what
the user has in terms of semi-permanent os-dependent applications
(taskbar, MS-Magnification, Office quick launch bar, etc)
7- you make your call calculate top and left position but for
efficiency, best is to use a percentage of screen.availWid th and
screenAvailHeig ht
8- Hint: only declare the windowFeatures which are requested, not the
ones you want to turn off, to disable
http://developer.mozilla.org/en/docs....open#Examples
}

If Javascript is enabled it should be there one new window with witdh
of 850 and height of 800. And if javascript disabled the big picture
should be open in an fresh ne window (target="_blank ").

If you want a complete, recommendable and working example, use this document

http://developer.mozilla.org/en/docs/DOM:window.open

and this example

http://developer.mozilla.org/en/docs...Best_practices

<a href="big.jpg" target="here" onclick="popup( this,850,screen .height-40)">

will open the page hrefered in links in a new naked window targeted
with same name as called in link ( target -> 'here' )
So ... no need of 'return false'
Dont understand ? the part _return false_ is used if javascript is
enabled to prevent the browser to open the new site in an extra new
full window.


Correct.
If JS is disabled, that will open a blank standard window


yes.

Ok i hope now its clear.


Gérard
--
remove blah to email me
Aug 12 '05 #8
ASM
Markus wrote:
ASM wrote:
It also would be interresting you see what exactly does :
screenshot?show =
This php file only build the entire popup website with the image of the
php paramter.


ok
GREAT it works!, but what happened to my elemt.get... code ? Can't
understand why there is no need for. How the browser know, witch File
he have to open ?


it is almost a standard html :

<a href="big.jpg" target="what_yo u_want">

will open file 'big.jpg' in the specified target

where is this target 'what_you_want' ?
in the window of popup launched on click ...

so ... what browser will do ?

... apply basically what it is made to :-)
If JS disabled, 'what_you_want' is unknown.
Because target is not '_self' nor '_top' or '_parent'
... no other choice than to create a new blank window
to receive the file
--
Stephane Moriaux et son [moins] vieux Mac
Aug 12 '05 #9
ASM
Markus wrote:
There is one probleme now: It don't work with IE :(. Now, i have to
find a solution.


stil on Mac ... with :
- IE5.2 -> OK

- Opera 8.0.1
- Safari
- iCab 3.0
- etc ...
... all OK

what's wrong with your IE ?

--
Stephane Moriaux et son [moins] vieux Mac
Aug 12 '05 #10

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

Similar topics

2
1746
by: Maik | last post by:
I Need a popup-killer script
8
1959
by: Bijoy Naick | last post by:
It seems like the BBC sports site is able to get past popup blockers.. For eg.. http://news.bbc.co.uk/sport1/hi/cricket/default.stm. Click on the Video icon under "Watch and Listen" - right hand frame. I have a popup blocker installed but the window still pops up.. Any one know how this can be done? BTW: I need this functionality for an intranet application. Bijoy
1
2861
by: Bill H | last post by:
I run a dbms application that interfaces with the web. This module creates a frames page with two frames ('main' and 'mwinfoframe'). All communication with the dbms is routed through the 'mwinfoframe' (it's sort of hidden in that it is assigned 1% (so I can view it in IE). I'm having problems with Firefox working properly while both IE 6 and Netscape v7.x work as expected. The following is additional information. A list of reports...
11
3520
by: Aaron | last post by:
I am trying to reuse a popup in my application. The reused popup also opens another popup. From this final popup I then try and reference a function located in the window that origionally opened the reused popup. This works fine in IE but doesn't in FireFox. Looking at the code through the Javascript debugger in FireFox it tells me that the reused popup's opener is closed even though it is still open. Is this a bug with FireFox or...
4
2432
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with dimensions of linked picture after clicking on a thumbnail. I found javascript which is compatible with IE, Firefox & Opera but I can't get it to work. All I get is this http://www.justfonts.com/tini/problem.html (thumbnail dissapeared).
3
2274
by: Alex | last post by:
Hi, I'm having some trouble implementing a popup in firefox. I attached some simplified code at the bottom. This is part of a firefox extension. What happens is that a popup window is created, the popup window updates it's data depending on what is shown on the main window. The problem comes when i click the 'X' to close the popup window. it crashes firefox, and closes all firefox windows. can somebody help me with this? why does this...
11
7343
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz 1.7.12 (linux kubuntu). It does work with konqueror. It seems to work with firefox on windows but not with IE (not completly sure though).
5
27194
by: James Black | last post by:
In Firefox I can resize the window that is created, but in IE I can't. Here is the code I am using: var generator=window.open('','name','height=500,width=675,resizeable=1,toolbar=0,menubar=0,scrollbars=1'); I also tried it with 'no' and 'yes' instead of '0' and '1'. I see the symbol in the window that I can click and drag, but, when I do click and drag, nothing happens.
1
12680
by: gvrajkumar | last post by:
Hi Popup window is opened and after some time session has expired. After session expire, if the user tries to make any actions on the popup page the user is redirected to login.jsp page. What I want is when the user tries to make any actions on the expired popup I want the popup window to be closed and parent window to be refreshed with the login.jsp page. Basically I want identify the popup window.
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9307
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9235
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6031
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.