Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 11th, 2006, 3:32 PM   #1
ktsirig
Programmer
 
Join Date: Oct 2005
Posts: 54
Rep Power: 3 ktsirig is on a distinguished road
check if Javascript is enabled and take actions

Hi,
I want to add a couple of pop-up boxes in my page, and I want to know :
1) is there a small piece of code that I must paste in my page which will check to see if the client has JS enabled?
2) do I use the <noscript> tag to enter the page that the user with no JS enabled will see?
3) if a user has JS enabled, do I need to check also if there are pop-up blockers, or it will be ok and my pop-up will open with no problem?

What I want basically is:
I have a link in the page ,which, if JS is enabled will open in a pop-up window when the user clicks on it, whereas, if JS is disabled, it will open in a new page, like plain, ordinary links

Thanks in advance
ktsirig is offline   Reply With Quote
Old Apr 11th, 2006, 6:03 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I don't ask, I just let the browser decide, based on the noscript tags. Pop-up blockers shouldn't prevent window opening operations from the parent. This statement, "open in a new page, like plain, ordinary links" isn't universally true.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 11th, 2006, 9:30 PM   #3
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
You can open a page in a new window without using JavaScript, mind. Just set the anchor tag's "target" attribute to "_blank", e.g
<a href="..." target="_blank">link</a>
Cerulean is offline   Reply With Quote
Old Apr 11th, 2006, 9:53 PM   #4
BaldEagle
Newbie
 
BaldEagle's Avatar
 
Join Date: Apr 2005
Location: Lisbon, CT
Posts: 9
Rep Power: 0 BaldEagle is on a distinguished road
Keep in mind that target="_blank" is not standards compliant for strict html 4.01 or xhtml 1.0

Just use transitional doctype if you do that.

BaldEagle
__________________
If you can't be kind, at least have the decency to be vague.

You may be only one person in the world, but you may also be the world to one person.

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names, and all are different colors, but they all manage to live comfortably in the same box.
BaldEagle is offline   Reply With Quote
Old Apr 12th, 2006, 6:33 AM   #5
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
Quote:
is there a small piece of code that I must paste in my page which will check to see if the client has JS enabled?
[sarcasm]
Why write code to check if JS is enabled? Write code to enable JS.
[/sarcasm]
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:38 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC