•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,419 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,648 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4069 | Replies: 13 | Solved
![]() |
•
•
•
•
Why not just put an anchor tagged link on the page. If I want the extra page, I will click it. I don't need bamboozlers popping up to attract me to the link.
you misunderstand the original issue, being that ie blocks any use of window.open(), even in a link. meaning the following is still blocked, and by the default explorer configuration, no less:
[html]<a href="javascript:window.open('newpage.html',params)">[/html]
--
The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
~Terry Pratchett
The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
~Terry Pratchett
•
•
•
•
you misunderstand the original issue, being that ie blocks any use of window.open(), even in a link. meaning the following is still blocked, and by the default explorer configuration, no less:
[html]<a href="javascript:window.open('newpage.html',params)">[/html]
Are you sure its not your browser settings or something? My example above works perfectly in IE.
Last edited by Inny : Jan 23rd, 2007 at 7:04 am.
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
W. C. Fields
--
The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
~Terry Pratchett
The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
~Terry Pratchett
A "better way" to write:
[html]
<a href="javascript:window.open('newpage.html',params)">
[/html]
is:
[html]
<a href="newpage.html" onclick="window.open('newpage.html',params); return false;">[/html]
That way it satisfies both users with and withought JavaScript support on their browser.
(winout JS you wont be able to control the window anyway)
Using href="javascript
some code)" will also write the returned object to the document window. So you'll get a blank page with "[object]" written in it in IE and in FF you get "[object Window]".
You could wrap the javascript in void() like:
[html]
<a href="javascript:void(window.open('newpage.html',params));">
[/html]
but thats just adding unnecessary code.
I've never had a problem with popup blockers blocking window.open() in an "onclick" event..
On non-interactive events.. like window.onload or setTimeout .. yes.
I've never tries javascript:window.open in the href attribute. Maybe thats handled differently. You should probably try the onclick method, as its more standard.
[html]
<a href="javascript:window.open('newpage.html',params)">
[/html]
is:
[html]
<a href="newpage.html" onclick="window.open('newpage.html',params); return false;">[/html]
That way it satisfies both users with and withought JavaScript support on their browser.
(winout JS you wont be able to control the window anyway)
Using href="javascript
some code)" will also write the returned object to the document window. So you'll get a blank page with "[object]" written in it in IE and in FF you get "[object Window]". You could wrap the javascript in void() like:
[html]
<a href="javascript:void(window.open('newpage.html',params));">
[/html]
but thats just adding unnecessary code.
I've never had a problem with popup blockers blocking window.open() in an "onclick" event..
On non-interactive events.. like window.onload or setTimeout .. yes.
I've never tries javascript:window.open in the href attribute. Maybe thats handled differently. You should probably try the onclick method, as its more standard.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Quick Help for Cookie script?
- Next Thread: Javascript and Firefox ISSUES


Linear Mode