473,614 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox and Local Links within Generated Content exhibits problems

The scenario: 1) Generate a popup window via script. 2) Populate it (again
via script) with content that features local (hash) links.

In IE 6.x this works - the links work as they should, moving the document to
that document position. However in FireFox 1.x the links load the main page
(the opener) in to the popup.

Both browsers populate the location.href of the popup with the main page's
href... but this only adversly affects FireFox (which seems to, in this
scenario, reload the whole page on a local link). I tried manually
populating the location.href but no joy.

I've appended an example which demonstrates the problem. I've tried to
shave it down as much as I could. Just save it to an HTML page and load it
up in FireFox. Click the button then scroll down and click the link...
instead of returning to the top of the page I get the opener page's HTML
populated into the popup.

Any thoughts on how to address this? I've Googled, but it may just be that
I've been unable to hit on the right terms to uncover the answer.

Thanks in advance for any direction,

Jim Davis
<html>
<head>
<title>Test Page</title>
<script type="text/JavaScript">
function CreateTestPopup () {
// Create Window
TestWindow =
window.open("", "TestWindow","s crollbars=yes,r esizable=yes,wi dth=500,height= 400");
var TW = TestWindow.docu ment;
// Write the HTML
TW.write( "<html><hea d>",
" <title>Test Window</title>",
"</head><body>",
"<a name='PageTop'> Page Top</a>",
"<br><br><br><b r><br><br><br>< br><br><br><br> ",
"<a href='#PageTop' >Go To Page Top</a>",
"</body></html>");
};
</script>
</head>
<body>
<p>This is just a test page.</p>
<p><input type="button" onclick="Create TestPopup();" value="Launch
Popup"></p>
</body>
</html>
Sep 1 '05 #1
3 2114
Jim Davis wrote:
The scenario: 1) Generate a popup window via script. 2) Populate it (again
via script) with content that features local (hash) links.

In IE 6.x this works - the links work as they should, moving the document to
that document position. However in FireFox 1.x the links load the main page
(the opener) in to the popup.

Both browsers populate the location.href of the popup with the main page's
href... but this only adversly affects FireFox (which seems to, in this
scenario, reload the whole page on a local link). I tried manually
populating the location.href but no joy.
The problem is that because you don't supply a URL, the popup uses the
URL of its parent. Clicking on the link links to the parent page - see
below.

[...]
<html>
<head>
<title>Test Page</title>
<script type="text/JavaScript">
function CreateTestPopup () {
// Create Window
TestWindow =
window.open("", "TestWindow","s crollbars=yes,r esizable=yes,wi dth=500,height= 400");
var TW = TestWindow.docu ment;
// Write the HTML
TW.write( "<html><hea d>",
" <title>Test Window</title>",
"</head><body>",
"<a name='PageTop'> Page Top</a>",
"<br><div onclick='alert( window.location .href)'>",
"Show href</div>",
"<br><br><br><b r><br><br><br>< br><br><br><br> ",
"<a href='#PageTop' >Go To Page Top</a>",
"</body></html>");
};
</script>
</head>
<body>
<p>This is just a test page.</p>
<p><input type="button" onclick="Create TestPopup();" value="Launch
Popup"></p>
</body>
</html>


Click on the text 'Show href' in the popup to see what I mean.

You could try linking to a real document and replace the content of the
HTML element. That will allow you to set a doctype etc and have a valid
document to boot.

--
Rob
Sep 1 '05 #2
"RobG" <rg***@iinet.ne t.au> wrote in message
news:LA******** *********@news. optus.net.au...
Jim Davis wrote: <snip>
The problem is that because you don't supply a URL, the popup uses the URL
of its parent. Clicking on the link links to the parent page - see below.
Yes... I agree that this is probably the cause... but how to get around it?

The behavior still strikes me as damn peculiar. I mean if FireFox sets the
href as the main page, fine (so does IE) - but internally it must lose this
someplace because it reloads the entire page when you go to an internal
link. On any other page with internal links it doesn't seem to reload the
page - it just scrolls to the target.

For it to do what it's doing it has to be comparing what it's displaying as
the href with something else, finding them different and reloading the page
using the "new" href.
Click on the text 'Show href' in the popup to see what I mean.
Oh - I already knew that: I actually said so in my original message. ;^)
You could try linking to a real document and replace the content of the
HTML element. That will allow you to set a doctype etc and have a valid
document to boot.


I'm sure that would solve it.

Unfortunately in this case I can't link a "real" document - this code is
part of a public debugging library: it may be used with Internet Access,
without Internet access, locally via a server, etc. The libraries may be
called from an external file or embedded in the main page.

As for the doctype - there's no reason I can't set it here: I just stripped
the code to the bone for the example (the code displays the same behavior
doctype or no).

Thanks for the thoughts,

Jim Davis
Sep 1 '05 #3
*** Jim Davis wrote/escribió (Wed, 31 Aug 2005 22:11:00 -0400):
The scenario: 1) Generate a popup window via script. 2) Populate it (again
via script) with content that features local (hash) links.

In IE 6.x this works - the links work as they should, moving the document to
that document position. However in FireFox 1.x the links load the main page
(the opener) in to the popup.


If you add document.write( this.location.h ref) to the child window you'll
see that its URL remains the same as its parent's (that's the same in both
browsers). So IE's behaviour is not really consistent.

I suggest you use the focus() method to browse child page.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Sep 1 '05 #4

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

Similar topics

10
2117
by: Vincent Poinot | last post by:
I've just noticed something strange in Firefox 1.0: it seems that the :after pseudo-element doesn't work as well as it used to. Have a look at: http://www.relinquiere.com/test1.html This is a simple list (ul) of images: I would like to display the titles of these images using generated content, so I used a simple rule: img:after { content: attr(title) ; }
4
9294
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form action="MaintNotification.php?ReqID=5" method="post" name="frm5"> <tr align="left" bgcolor="#dddddd" class="text" onClick="submit()"
1
1249
by: Andy Stevenson | last post by:
<delurk> Hi, It's not often I feel the need to ask a direct question, most of the problems I come across are sorted with sufficient Googling, FAQ reading or divine inspiration... But not this time :( A very simple site in the early stages: http://www.lmbc.no-ip.co.uk/ for a local club. The Nav Bar on the right hand side works fine in Moz. Firefox, but in IE, the links dont work after the level of the main content.
6
14444
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
5
1300
by: bspittles | last post by:
Can anyone tell me why the following script doesn't work in Firefox 1.5 (not sure about other versions) when it works fine in IE6 and Netscapes 7.1? Almost as importantly ;) can ayone tell me how to fix it? <script language=javascript> function showphoto(pic, player, w, h, winname) { photowin = window.open("",winname, "menubar=no,width=" + w + ",height=" + h + ",resize=no"); photowin.document.write("<HTML><HEAD><TITLE>" + player +
13
2866
by: Giggle Girl | last post by:
Hi there, I am having a problem with the behavior of Firefox, where lefthand column content is not resized properly after it is "collapsed" and then "re-expanded". An online demo is available here: http://s161149005.onlinehome.us/DEMOS/FF/RESIZE_PROB/main/frameset.asp It works fine in IE 6, but in Firefox, it is broken. Specifically, when the page/frameset first loads in either browser, it looks correct. But when you click the...
14
7384
by: arteccentrix | last post by:
Please bear with me as I am new to both Firefox and CSS. I have browsed through a number of groups looking for similar problems to my own but can't find a definitive answer. If anyone here can help me out I would appreciate your shared expertise so much. My background image is displaying fine in IE, and, sometimes in Firefox until I hit the reload button. It seems as if the browser is unable to locate the image and throws up a graphic...
2
1370
by: Steve D. | last post by:
I am using a MasterPage where the middle column - in a table of 3 columns - contains the ContentPlaceholder. Within this ContentPlacehoder, on a different page, I use tables to layout sections of my form. The form renders as I would expect in IE7. In FireFox, the column widths are all out of whack - mostly, they are too wide. Looking at the generated page source in FireFox I cannot immediately see why
0
1615
by: Bouzy | last post by:
I have a problem that I know gets asked about a lot. Its how my page differs in IE vrs. Firefox. I know IE sucks, but hears whats going on. IE... http://i93.photobucket.com/albums/l75/Bouzy_Bouzy/IEGOLD.jpg Firefox... http://i93.photobucket.com/albums/l75/Bouzy_Bouzy/FIREFOX.jpg (Note the positioning of the text in the sidebars) I hate the fact that my pages look sweet in Firefox, but not IE.. I don't even know what div is giving me...
0
8130
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8627
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8579
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
8279
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
8433
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...
1
6088
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5540
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
4127
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1747
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.