473,386 Members | 1,790 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,386 software developers and data experts.

Opera <NOSCRIPT> will be executed...Flash detection

Hello,
there is a known problem with Opera and the execution of content shown
in <NOSCRIPT> tag.

Everythings works fine, if there is only one simple script like:
http://www.dr-wald.de/test/Opera-NOSCRIPT.html

Switching off Javascript will show the alternative content. Javascript
enabled will only show the JS-content, _not_ the <NOSCRIPT> content.

But:
If there are some more scripts in a page, JS content _and_ alternative
<NOSCRIPT> content is shown, if there seems to be a script error or an
unknown script before executing the error script. This behavior is
according to the W3C, but IMHO not useful:
http://www.w3.org/TR/1998/REC-html40....html#h-18.3.1

I am developing a Flash browser detection working also with Opera, not
only Moz/IE: There shall be displayed an alternative content, if flash
is not supported or if flash version is to low.
Macromedia is providing a browser detection script, which works fine
with Opera, if _any_ flash version is installed.

But:
If _NO_ flash is installed (rename
c:\Programme\Opera72\Program\Plugins\NPSWF32.dll) javascript content
_and_ alternative <NOSCRIPT> content will be shown:
http://www.dr-wald.de/test/mainframetest.html

I do not know how to solve this problem!

There must be a problem with the following code:
<script type="text/javascript">
<!--
var contentVersion = 5;
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var PluginVersion = words[i];
}
var FlashCanPlay = PluginVersion >= contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
[...]
Please, are there any hints?
X-Post2 comp.lang.javascript,opera.page-authoring
Fup2 comp.lang.javascript

--
Best regards/ MfG,
Gustav Medler
pm.gustav.medler (at) gmx.net
*Mail reply will not be read,
*please use address above!
Jul 20 '05 #1
6 4727
On Thu, 6 Nov 2003 08:52:46 +0100, "Gustav Medler"
<no*******@nurfuerspam.de> wrote:
there is a known problem with Opera and the execution of content shown
in <NOSCRIPT> tag.
No, as you suggest later, there's a known problem with the other UA's
and the HTML specification.
I do not know how to solve this problem!
NOSCRIPT is generally useless for the above reasons, avoid it, use
more appropriate methods to degrade (e.g. only have javascript write
content you're unsure about, use pure HTML approaches to degrading
flash - don't use flash...)
var plugin = (navigator.mimeTypes &&
This needs to check for a navigator object.
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0


This is flawed...

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #2
Jim Ley <ji*@jibbering.com> wrote/schrieb:
var plugin = (navigator.mimeTypes &&

This needs to check for a navigator object.
else if (navigator.userAgent &&
navigator.userAgent.indexOf("MSIE")>=0

This is flawed...


I do know the problems about the UA's espacially from Opera. In my
opinion a good resolution is not to detect the UA's but using
(!window.opera) or (window.opera). This is IMHO displayed every
time.....

But this issue doe not solve my problem described above.
--
Best regards/ MfG,
Gustav Medler
pm.gustav.medler (at) gmx.net
*Mail reply will not be read,
*please use address above!
Jul 20 '05 #3
On Thu, 6 Nov 2003 12:21:29 +0100, "Gustav Medler"
<no*******@nurfuerspam.de> wrote:
But this issue doe not solve my problem described above.


Yes, I addressed that in my other points - don't use NOSCRIPT, it's
flawed, using OBJECT or similar to just display the flash with
appropriate degrading, or only add the flash if you've successfully
detected that it's supported, and you can replace the fallback
content.

I don't really understand your actual problem - what are you putting
in NOSCRIPT that's so disastrous that it's displayed aswell as the
flash? if it's "install flash" then you're just misusing
web-authoring, your page should degrade.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #4
Jim Ley <ji*@jibbering.com> wrote/schrieb:
Yes, I addressed that in my other points - don't use NOSCRIPT, it's
flawed, using OBJECT or similar to just display the flash with
appropriate degrading, or only add the flash if you've successfully
detected that it's supported, and you can replace the fallback
content.
That's it want I want to do in Javascript ;-)
But Opera seems to be a little bit particular especially if _no_ flash
plugin is installed. All tested cases are working under all
circumstances, NS4.7, Moz, Konqueror, IE. Only Opera shows the problem
of displaying script _and_ noscript content simultaneously.
I don't really understand your actual problem - what are you putting
in NOSCRIPT that's so disastrous that it's displayed aswell as the
flash? if it's "install flash" then you're just misusing
web-authoring, your page should degrade.


On the one hand the NOSCRIPT content shall be a static picture of the
animated content. I will not ask a visitor to install or update the
flash plugin, because in my opinion it will be boring for them.
On the second hand there are some layout problems if _no_ content is
displayed.

How to change this script for detecting that no plugin is installed in
an Opera browser?
[Example page at: http://www.dr-wald.de/test/mainframetest.html ]
<script type="text/javascript">
<!--
var contentVersion = 5;
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var PluginVersion = words[i];
}
var FlashCanPlay = PluginVersion >= contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
[...]
--
Best regards/ MfG,
Gustav Medler
pm.gustav.medler (at) gmx.net
*Mail reply will not be read,
*please use address above!
Jul 20 '05 #5
On Thu, 6 Nov 2003 16:17:25 +0100, "Gustav Medler"
<no*******@nurfuerspam.de> wrote:
On the one hand the NOSCRIPT content shall be a static picture of the
animated content. I will not ask a visitor to install or update the
flash plugin, because in my opinion it will be boring for them.
Great, so use your script, detect flash, if it's found replace the
fallback image in the page with the flash, no need to do anything in
the situation where flash isn't detected, you just leave the document
as is, same as when script is disabled.
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {


As I noted before, this script is flawed, your problem is a lot more
than opera with this approach.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #6
Jim Ley <ji*@jibbering.com> wrote/schrieb:
Great, so use your script, detect flash, if it's found replace the
fallback image in the page with the flash, no need to do anything in
the situation where flash isn't detected, you just leave the document
as is, same as when script is disabled.


Resolution found!

Problem:
JS-Browser detection works fine if any version of flash plugin
(vers.2-7) is installed. If there is _NO_ flash plugin installed, SCRIPT
and NOSCRIPT content will be executed by Opera, pictures for example
will be shown twice.
This behavior is according to W3C because Opera does not know the
'SCRIPT LANGUAGE=VBScript' and will trade it as a script error with
execution of the NOSCRIPT content.
http://www.w3.org/TR/1998/REC-html40....html#h-18.3.1

Resolution:
This behaviour can be solved simply by adding 'window.opera &&' to this
line of the detection script:

else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {

Better version:

else if (!window.opera && navigator.userAgent &&
navigator.userAgent.indexOf("MSIE")>=0 &&
(navigator.appVersion.indexOf("Win") != -1)) {

Browser detection in Opera is difficult because of spoofing, but IMHO
'Opera' will always be shown.....

The whole flash detection script works now including display of alternative
content
for 'too low flash version',
for 'no flash plugin detected/installed' and
for 'javascript disabled'
in NS4.7+, IE 5+, Opera5+, Moz1+, Konqueror3+ on Win32/Linux.

[Somebody surfing with MAC???]

Whole detection script:

<!-- Start Flash -->
<script type="text/javascript">
<!--
var contentVersion = 5;
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var PluginVersion = words[i];
}
var FlashCanPlay = PluginVersion >= contentVersion;
}
else if (!window.opera && navigator.userAgent &&
navigator.userAgent.indexOf("MSIE")>=0 &&
(navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('FlashCanPlay = (
IsObject(CreateObject("ShockwaveFlash.ShockwaveFla sh." &
contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( FlashCanPlay ) {
document.write('<OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflas
h.cab#version=6,0,0,0" ID="schloss_gr" WIDTH="365" HEIGHT="265">');
document.write('<PARAM NAME="movie" VALUE="schloss_gr.swf"><PARAM
NAME="quality" VALUE="high"><PARAM NAME="scale" VALUE="exactfit"><PARAM
NAME="bgcolor" VALUE="#E2E2E2">');
document.write('<EMBED src="schloss_gr.swf" quality="high"
scale="exactfit" bgcolor="#E2E2E2" swLiveConnect=FALSE WIDTH="365"
HEIGHT="265" NAME="schloss_gr" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
document.write('</EMBED>');
document.write('</OBJECT>');
} else{
document.write('<a href="../start/index.html" target="_parent"><img
src="../index/schloss_gr.jpg" width="365" height="245" border="0"
alt="Praxis"></a>');}
//--></script>

<noscript>
<a href="../start/index.html" target="_parent"><img
src="../index/schloss_gr.jpg" width="365" height="245" border="0"
alt="Praxis"></a>
</noscript>
<!-- End Flash -->
--
Best regards/ MfG,
Gustav Medler
pm.gustav.medler (at) gmx.net
*Mail reply will not be read,
*please use address above!
Jul 20 '05 #7

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

Similar topics

2
by: llaxman | last post by:
Hello everyone, I was wondering if anyone can help me? I am having some problems wit the <noscript> tag. I actually use it to block banner advertisements from being displaye in my website. I...
12
by: Burton Figg | last post by:
My homepage, www.jimpix.co.uk uses transitional XHTML. The whole thing validates except one line: <noscript><img height="1" width="1" alt=""...
13
by: Paul | last post by:
Hello: I read the FAQ about embedding HTML code in a Javascript. I have used the "<\/tag>" format to get around validator problems. Now the <NOSCRIPT> block is failing with error #65: 1. ...
7
by: Spartanicus | last post by:
Afaik the use of a <noscriptelement is frowned upon nowadays. For a JS random image changer I tried to use a replacement by having the script change the HTML src attribute value of an img element....
2
by: pow1983 | last post by:
Hi, Is there a tag or script or something I can use to automatically forward people to a HTML page if they dont have flash installed or disabled by their company. Many Thanks, Rich
1
by: Gretsch | last post by:
I have a lot of nicely formatted HTML to be displayed for visitors WITHOUT script (/enabled), and a second set of HTML for those WITH script. The <noscript> tag allows me to separate the HTML for...
28
by: FreeCopywritingTips | last post by:
Does anyone know how to get around the </noscriptissue, were my HTML editor refuses to save this tag?
4
by: phpmel | last post by:
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script language="JavaScript"...
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: 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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.