![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 54
Rep Power: 3
![]() |
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 |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
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> |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Apr 2005
Location: Lisbon, CT
Posts: 9
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#5 | |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
Quote:
Why write code to check if JS is enabled? Write code to enable JS. ![]() [/sarcasm]
__________________
PFO - My daily dose of technology. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|