473,385 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Opening Window With Target

Does anyone know how to replace <a href="url" target="_blank"> with
window.open, keeping the window settings the same, i.e. same size, same
toolbars, etc.

I've tried document.open, and window.target, but nothing I do seems to
open in a new window.

Cheers, Rob.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
3 2691
Hi Rob,

Robert Atkinson wrote:
Does anyone know how to replace <a href="url" target="_blank"> with
window.open, keeping the window settings the same, i.e. same size, same
toolbars, etc.

if you use
<a href="http://www.google.com" onclick="window.open('http://www.google.com','');return (false)";>open win</a>
the window will be opened with default size by the onclick handler function. This will also work if the user has
JS disabled, because the href is still there. Of cause you can use this with any event handler.

cu, Michael
Jul 23 '05 #2
<a href="url" onclick="SomeName=window.open('','SomeName','')"
target="SomeName">
I think. Those are pairs of empty single quotes within the widow open
statement, not souble quotes.
"Robert Atkinson" <ratkinson@tbsdotltddotcodotuk> wrote in message
news:40**********************@news.newsgroups.ws.. .
Does anyone know how to replace <a href="url" target="_blank"> with
window.open, keeping the window settings the same, i.e. same size, same
toolbars, etc.

I've tried document.open, and window.target, but nothing I do seems to
open in a new window.

Cheers, Rob.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 23 '05 #3
Robert Atkinson wrote:
Does anyone know how to replace <a href="url" target="_blank"> with
window.open, keeping the window settings the same, i.e. same size, same
toolbars, etc.

I've tried document.open, and window.target, but nothing I do seems to
open in a new window.

Cheers, Rob.


You can't do this. There is no way to determine the size of the current
browser window in a cross-browser compatible way. You also can't reliably
detect the current chrome (what menus, toolbars and statusbars might be
showing).

<a href="url" target="_blank"> usually opens a new window with the default
size, position (although windows will shift the window down and to the
right approximately 20 pixels so you can see the titlebar of the original
window) and with the default chrome.

You can attempt to control the chrome using window.open(), but there is no
guarantee you will open a new window, let alone control the chrome that
window has (any new window that a Web site attempts to open gets opened in
a new tab for me in Firefox, so any of your attempts to control the size,
position or chrome of a new window fail).

In the future, check the documentation, rather then trying things at random
hoping it will work. Computer programming (which is what "Javascripting"
is) requires very specific syntax to work correctly.

Information about window.open()

<url:
http://devedge.netscape.com/library/...w.html#1202731
/>
<url:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp
/>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4

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

Similar topics

1
by: John | last post by:
HI, I was wondering if it is possible to target a named anchor in a frame when opening a new window with a javascript function? has anyone actualy been able to do this? Thanks in advance for...
3
by: Display Name | last post by:
When this form's being submitted, two windows are opening instead of only one here is the function I'm using: function subForm(){ //insert form validation here //if form is valid, open a...
8
by: ajay | last post by:
How to make a new page appear in tab instead of new window. I use Netscape 7+. Is there any provision to do in HTML language ? Ajay
44
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the...
14
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...
2
by: sjp | last post by:
I need to open new windows only for the purpose of viewing linked images, maybe a dozen or so throughout the site. Using the Target="blank" command is quick, easy and seems like the best way to...
2
by: Keshav Gadia | last post by:
Hi, I am an ASP.net newbie. I am writing a user control that is made up of datagrid with one of the columns opening a new window to display some details on click of the set image. I have...
44
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute...
26
by: Nospam | last post by:
I am trying to open a link in a new template window : <a onclick="windowopen('example.html','example');return false;" href="http://www.example.com" target="_blank"example link</a> such that...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.