473,832 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginner needs help getting script to work in Safari 1.0.2

Hi,

I realize my first problem is that I'm using browser detection and not
feature detection. Maybe someone can help me understand feature
detection.
This script works in every browser that I need it too, except Safari
1.0.2

Here is the script. Please tell me if there is any more information I
can give you.
<script language=javasc ript type="text/javascript">
function hideDiv() {
if (document.getEl ementById) {
document.getEle mentById('hides how').style.vis ibility = 'hidden';
}
else {
if (document.layer s) {
document.hidesh ow.visibility = 'hidden';
}
else { document.all.hi deshow.style.vi sibility = 'hidden';
}
}
}
function showDiv() {
if (document.getEl ementById) {
document.getEle mentById('hides how').style.vis ibility = 'visible';
}
else {
if (document.layer s) { document.hidesh ow.visibility = 'visible';
}
else { document.all.hi deshow.style.vi sibility = 'visible';
}
}
}</script>

<script LANGUAGE=JavaSc ript>var movieName = "movie";

function thisMovie(movie Name) {
if (navigator.appN ame.indexOf ("Microsoft" ) !=-1) {
return window[movieName]
} else {
return document[movieName]
}
}
function rewind() {
thisMovie(movie Name).Rewind();
thisMovie(movie Name).StopPlay( );
hideDiv();
}

function play(){
showDiv();
thisMovie(movie Name).Play();
}</script>
Thanks
Kim
Jul 23 '05 #1
5 2106
Lee
Kim Forbes said:
Here is the script. Please tell me if there is any more information I
can give you.
Could you format it with some indentation to make it readable?

<script language=javasc ript type="text/javascript">
function hideDiv() {
if (document.getEl ementById) {
document.getEl ementById('hide show').style.vi sibility = 'hidden';
}
else {
if (document.layer s) {
document.hides how.visibility = 'hidden';
}
else { document.all.hi deshow.style.vi sibility = 'hidden';
}
}
}
function showDiv() {
if (document.getEl ementById) {
document.getEl ementById('hide show').style.vi sibility = 'visible';
}
else {
if (document.layer s) { document.hidesh ow.visibility = 'visible';
}
else { document.all.hi deshow.style.vi sibility = 'visible';
}
}
}</script>


Jul 23 '05 #2
In article <de************ **************@ posting.google. com>,
ki********@tch. harvard.edu enlightened us with...
Hi,

I realize my first problem is that I'm using browser detection and not
feature detection. Maybe someone can help me understand feature
detection.
You ARE using feature detection for some of it.
This script works in every browser that I need it too, except Safari
1.0.2

What happens (or doesn't happen) in Safari?
Here is the script. Please tell me if there is any more information I
can give you.
<script language=javasc ript type="text/javascript">
function hideDiv() {
if (document.getEl ementById) {
document.getEle mentById('hides how').style.vis ibility = 'hidden';
Don't assume that a browser that supports getElementById also supports style.
Check for that, too.
}
else {
if (document.layer s) {
document.hidesh ow.visibility = 'hidden';
}
else { document.all.hi deshow.style.vi sibility = 'hidden';
}
Don't assume. Your last 'else' assumes that if a browser doesn't have the
first two, it has the third. Bad assumption.
Make it an else if document.all, then have a last else that basically shows a
friendly error or something that the browser isn't supported.

<script LANGUAGE=JavaSc ript>var movieName = "movie";

Type attribute here like above would be great.
function thisMovie(movie Name) {
if (navigator.appN ame.indexOf ("Microsoft" ) !=-1) {
return window[movieName]
} else {
return document[movieName]
}


You could just test for window[movieName] (that doesn't look right to me, but
I'm not familiar with media) and document[movieName] instead of using
navigator.

That's all I have, sorry.
--
--
~kaeli~
Punctuation, capitalization, and grammar are your friends,
and will help people think that you aren't such an ignorant
moron, after all.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
Kim Forbes wrote:
Hi,

I realize my first problem is that I'm using browser detection and not
feature detection. Maybe someone can help me understand feature
detection.
This script works in every browser that I need it too, except Safari
1.0.2


I don't understand why you want to control the playing of the video
yourself. Safari will load the video into a Quicktime plugin which
already has controls for play, pause, stop, rewind, fastforward,
volume, etc.

Placing a second set of controls will likely only confuse the user -
what's the point? The general form for putting a Quicktime movie (.mov)
file into a browser window is (please excuse wrapping):

<OBJECT
CLASSID="clsid: 02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
WIDTH="240" HEIGHT="152"
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#ve rsion=6,0,2,0">
<PARAM NAME="controlle r" VALUE="TRUE">
<PARAM NAME="type" VALUE="video/quicktime">
<PARAM NAME="autoplay" VALUE="false">
<PARAM NAME="target" VALUE="myself">
<PARAM NAME="src" VALUE="somePath/myMovie.mov">
<PARAM NAME="pluginspa ge"
VALUE="http://www.apple.com/quicktime/download/indext.html">
<EMBED WIDTH="240" HEIGHT="152"
CONTROLLER="TRU E" TARGET="myself"
SRC="somePath/myMovie.mov"
type="video/quicktime"
BGCOLOR="#00000 0" BORDER="0"
PLUGINSPAGE="ht tp://www.apple.com/quicktime/download/indext.html"></EMBED>
</OBJECT>
Fred.
Jul 23 '05 #4
This really got me thinking, so here is a page that lets you
load/unload a Quicktime movie. I thinks it's cool because the video is
not hosted on my server but on Apple's!

I tried just showing/hiding the div, and whilst that works the first
time, when you hide it then show it again, the video doesn't play. I
have commented out the bits that display the video in a new window, you
can use that instead if you want.

This is not robust, www ready code but a proof of concept effort - I'm
happy for suggestions on how to detect if the user has the Quicktime
plugin installed - or should I just let the browser handle it?

Hope it works for everyone out there, please be careful of wrapping...

Fred.

<html><head><ti tle> Safari Video</title>
<script type="text/javascript">

function loadVid(vidDiv) {

// var vidWin = window.open('',
// 'VideoWindow',' resizable=1,wid th=400,height=4 00')

var a = [
// '<html><head><t itle> Video Window</title>',
// '</head><body>',
'<OBJECT id="aMovie" ',
'CLASSID="clsid :02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
' WIDTH="240" HEIGHT="152" ',
'
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#ve rsion=6,0,2,0"> ',
' <PARAM NAME="controlle r" VALUE="TRUE"> ',
' <PARAM NAME="type" VALUE="video/quicktime"> ',
' <PARAM NAME="autoplay" VALUE="true"> ',
' <PARAM NAME="target" VALUE="myself"> ',
' <PARAM NAME="src" ',
' VALUE="file:///Users/rogreen/Desktop/farscape_240.mo v"> ',
' <PARAM NAME="pluginspa ge" ',
' VALUE="http://www.apple.com/quicktime/download/indext.html">',
' <EMBED WIDTH="240" HEIGHT="152" ',
' CONTROLLER="TRU E" TARGET="myself" ',
'
SRC="http://movies.apple.co m/movies/independent/farscape/farscape_240.mo v"
',
' type="video/quicktime" ',
' BGCOLOR="#00336 6" BORDER="0" ',
' PLUGINSPAGE="ht tp://www.apple.com/quicktime/download/indext.html">',
'</EMBED> ',
'</OBJECT> ',
// '</body></html>',
];
// alert(a.join(" "));

document.getEle mentById(vidDiv ).innerHTML = a.join(" ");
document.getEle mentById(vidDiv ).style.display = '';

// vidWin.document .write(a.join(" "))
// vidWin.document .close()

}

function unLoadVid(vidDi v) {
document.getEle mentById(vidDiv ).style.display = 'none';
document.getEle mentById(vidDiv ).innerHTML = "";
}
</script>

</head><body>

<div style="border: thin solid red; width: 240; height: 30;">
<form action="">
<input type="button" value="Video load"
onclick="loadVi d('theMovie');" >&nbsp;
<input type="button" value="Video unload"
onclick="unLoad Vid('theMovie') ;">
</form>
</div>
<div id="theMovie"
style="border: thin solid red; width: 240; height: 152; display: none;">
</div>

</body></html>
Jul 23 '05 #5
Thanks everyone for answering my post. I have had a incredibly busy
week, and I'm just checking my messages now. I am going to look them
over in detail ASAP, but let me just clarify what I was trying to do:
I wanted a Flash movie to play "inline" from a HTML help topic I was
writing. For example, if I was showing people how to use Widget x, I
wanted to give the user an option of viewing the procedure from the
topic, but not force the movie to play upon loading the topic. I hope
that makes sense?

Kim
Fred Oz <oz****@iinet.n et.au> wrote in message news:<41******* *************** *@per-qv1-newsreader-01.iinet.net.au >...
This really got me thinking, so here is a page that lets you
load/unload a Quicktime movie. I thinks it's cool because the video is
not hosted on my server but on Apple's!

I tried just showing/hiding the div, and whilst that works the first
time, when you hide it then show it again, the video doesn't play. I
have commented out the bits that display the video in a new window, you
can use that instead if you want.

This is not robust, www ready code but a proof of concept effort - I'm
happy for suggestions on how to detect if the user has the Quicktime
plugin installed - or should I just let the browser handle it?

Hope it works for everyone out there, please be careful of wrapping...

Fred.

<html><head><ti tle> Safari Video</title>
<script type="text/javascript">

function loadVid(vidDiv) {

// var vidWin = window.open('',
// 'VideoWindow',' resizable=1,wid th=400,height=4 00')

var a = [
// '<html><head><t itle> Video Window</title>',
// '</head><body>',
'<OBJECT id="aMovie" ',
'CLASSID="clsid :02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
' WIDTH="240" HEIGHT="152" ',
'
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#ve rsion=6,0,2,0"> ',
' <PARAM NAME="controlle r" VALUE="TRUE"> ',
' <PARAM NAME="type" VALUE="video/quicktime"> ',
' <PARAM NAME="autoplay" VALUE="true"> ',
' <PARAM NAME="target" VALUE="myself"> ',
' <PARAM NAME="src" ',
' VALUE="file:///Users/rogreen/Desktop/farscape_240.mo v"> ',
' <PARAM NAME="pluginspa ge" ',
' VALUE="http://www.apple.com/quicktime/download/indext.html">',
' <EMBED WIDTH="240" HEIGHT="152" ',
' CONTROLLER="TRU E" TARGET="myself" ',
'
SRC="http://movies.apple.co m/movies/independent/farscape/farscape_240.mo v"
',
' type="video/quicktime" ',
' BGCOLOR="#00336 6" BORDER="0" ',
' PLUGINSPAGE="ht tp://www.apple.com/quicktime/download/indext.html">',
'</EMBED> ',
'</OBJECT> ',
// '</body></html>',
];
// alert(a.join(" "));

document.getEle mentById(vidDiv ).innerHTML = a.join(" ");
document.getEle mentById(vidDiv ).style.display = '';

// vidWin.document .write(a.join(" "))
// vidWin.document .close()

}

function unLoadVid(vidDi v) {
document.getEle mentById(vidDiv ).style.display = 'none';
document.getEle mentById(vidDiv ).innerHTML = "";
}
</script>

</head><body>

<div style="border: thin solid red; width: 240; height: 30;">
<form action="">
<input type="button" value="Video load"
onclick="loadVi d('theMovie');" >&nbsp;
<input type="button" value="Video unload"
onclick="unLoad Vid('theMovie') ;">
</form>
</div>
<div id="theMovie"
style="border: thin solid red; width: 240; height: 152; display: none;">
</div>

</body></html>

Jul 23 '05 #6

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

Similar topics

4
2263
by: MPennig | last post by:
Here's my situation. I have a function defined in my document's <head> section which adds a <script> tag to a specified <div> tag. The added <script> has a src="" attribute pointing to a PHP file, which dynamically returns JavaScript. In Safari, the src file isn't downloaded. Neither is any code contained within the new script tag . In IE(6) and Firefox, this works as expected. Here's my code. I hope it will better illustrate what I'm...
21
4011
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does nothing in IE. I'd be greatful for any assistance. Also, if I will have problems the code on Opera or Safari, I'd appreciate any pointers--I don't have a Mac to test Safari. THanks very much, Michael
13
2260
by: elektrophyte | last post by:
I've got a short script that works fine in I.E. and Firefox, but not in Safari. It is supposed to print a constantly-updating counter on the webpage. Any ideas how to get it to work in Safari? The script uses the Date object, especially Date.getTime(). Could that have something to do with the problem? Thanks, E
11
2713
by: Andrew Poulos | last post by:
Is there a safe way to get the version of IE? I've done a google and found this code: var version=0 if (navigator.appVersion.indexOf("MSIE") != -1) { temp = navigator.appVersion.split("MSIE"); version = parseFloat(temp); } but I have no idea how "robust" it is.
6
3012
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python interface is providing a convenient scripting toolkit for the application. One example is that a user can write a python script like: player = Player() game.loadPlayer(player) player.moveTo(location)
13
36099
by: Ralph | last post by:
Hi Is it possible to trigger the certain event from JS function? I have an image with on click event handler assigned. Now if like to trigger this event for this image from some other function. --
10
2472
by: gentsquash | last post by:
Can javascript (easily) produce a click from the PC-speaker? This is the speaker that is (well, used to be) directly on the CPU-card and was -I believe- intended to give feedback to the typist, making a click-sound on each keypress. On Unix/Linux/MacOSX systems, you can hear this click by typing ^g (control g) into a shell/terminal. This is also the click made by ^g when it is typed in Emacs, or when Emacs signals an error.
29
4101
by: Chris Riesbeck | last post by:
I have an image with a class and the class defines a clip rectangle. In Firefox 2 and 3, and Opera 9, I can access the rectangle with document.defaultView.getComputedStyle(). But that doesn't seem to work in Safari for Windows 3, nor when I use image.currentStyle.clip in IE 7. Is there a way to do this in those browsers? Am I doing something stupid?
22
18154
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php programmer and looking for a starting point in regards to practical projects to work on. What are some projects that beginner programmers usually start with? Please list a few that would be good for a beginner PHP programmer to
0
9795
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10781
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10541
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5624
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3972
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3078
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.