Stop user being forced to top when opening new window

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Stop user being forced to top when opening new window

Postby bonefishjoey » Tue 15 Nov, 2005 1:49 pm

Hi there.

I'm using Dreanweaver and I open a new window when the user clicks on an image. How do I stop the user being forced to the top of the main window and thus having to navigate back to the image when he closes the new window?
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
bonefishjoey
new member
new member
 
Posts: 1
Joined: Tue 15 Nov, 2005 1:43 pm

Postby akbash » Sun 20 Nov, 2005 6:07 pm

My interpretation: you've built a web page containing an image. When clicked, that image causes a new window to be opened, and simultaneously scrolls the page containing the image to the top of the page.

If I've understood correctly, this is usually caused by HTML that looks like
Code: Select all
<a href="#" onclick="window.open('http://www.yahoo.com/')">
  <img src="yahoo.gif">
</a>
This construction is simply ignorant, and disappointingly common. The authors of Dreamweaver are not supposed to be dummies. If I were a paying customer, I think I'd let them know I expected better.

In the meantime, it's difficult to prescribe an exact fix not knowing the particulars of your webpage. For my own example, I suggest
Code: Select all
<a href="http://www.yahoo.com" target="_blank">
  <img src="yahoo.gif" alt="yahoo">
</a>
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051113 Firefox/1.5
akbash
silver member
silver member
 
Posts: 364
Joined: Mon 09 Feb, 2004 9:13 pm

Re: Stop user being forced to top when opening new window

Postby Antony » Sun 20 Nov, 2005 7:23 pm

bonefishjoey wrote:Hi there.

I'm using Dreanweaver and I open a new window when the user clicks on an image. How do I stop the user being forced to the top of the main window and thus having to navigate back to the image when he closes the new window?
If I understand correctly, you want to provide a window being opened (when user clicks), but that new window is below the current window?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.11 (KHTML, like Gecko) Safari/416.12
User avatar
Antony
diamond member
diamond member
 
Posts: 15257
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia


Return to Web Design and Page Coding

Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]