2

I am using JQuery.

I have got one link as given below:

<li><a href="http://staging/english/Skywards/skywards.aspx" id="skywardsTopLoginLink">Login</a></li>

Now I want to check on page load whether Flash/javascript is installed or disabled and according to output the Login link will work, I mean if flash/javascript is disabled or not installed then it will go to the above Href else it will open jQuery model dialog box for login functionality

2 Answers 2

1

To load and check flash version etc, use and load SWFObject like this (it's just an example, check their documentation for more details) :

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myId", "9.0.115", "expressInstall.swf");
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>

<div id="myContent">
  <p>Alternative content</p>
</div>

And add a <noscript> tag in case JS isn't activated.

Example about using this tag here.

That'll make your code like this :

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myId", "9.0.115", "expressInstall.swf");
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>

<div id="myContent">
  <p>Alternative content for flash</p>
  <noscript>Alternative content for JS</noscript>
</div>

Be aware that people w/o JS will see both messages.

Sign up to request clarification or add additional context in comments.

Comments

0

try to set a cookie onLoad, and read it on server-side. If JS disabled there will be no cookie. Use <noscript> tag to inform user to enable it.


User SWFObject to detect Flash. As mentioned here: Cross Browser Flash Detection in Javascript

Now, there are two things.

If you just want to show alternate content/link use <noscript>as mentioned here http://www.w3schools.com/tags/tag_noscript.asp

If you want your webapplication to serve content that does not uses JS facilities, you may want to drop a cookie. Like here: http://www.w3schools.com/JS/js_cookies.asp try to read this cookie in server side code and set this info (in session) whether or not the user has JS enabled browser. Then use this info to serve non-JS content for future pages/requests.


realized you have JQuery, you can very well use this plugin http://plugins.jquery.com/project/Cookie

6 Comments

Thanks @Nishant, can you please clear it more how to set cookies for flash and Javascript detection and would appreciate if you have got some links with examples.
I was primarily answering for JavaScript detection. But I will update the answer.
I was about to +1 you @Nishant . And then, I saw w3schools links.
:) what's the matter with w3school?
They're unreliable. Seriously. Even more on JS. Nothing to do with W3C (lots of people doesn't see the difference)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.