Improve company productivity with a Business Account.Sign Up

x
?
Solved

Play .avi in new window

Posted on 2001-08-31
12
Medium Priority
?
433 Views
Last Modified: 2010-05-18
I want to create a link that would open a new window,automatically play an .avi file. and automatically close afterwards.
0
Comment
Question by:kaushalshah
  • 4
  • 3
  • 2
  • +3
12 Comments
 
LVL 1

Expert Comment

by:FranzRinkleff
ID: 6445284
use the following for the link

<a href="javascript:window.open('aviWindow.html', 'newAviWindow', 'width=200, height=200')">Play AVI File</a>


In the file called aviWindow.html embed your avi file with the following.

<embed src="locationofAviFile.avi" loop="2" autostart="true"</embed>
0
 
LVL 1

Expert Comment

by:Ernest022699
ID: 6448410
Just make sure that the user WANTS to play the avi file!  There are too many Site out there now which play annoying and intrusive sounds (which, by the way, consume bandwidth to download).
0
 
LVL 4

Expert Comment

by:daluu
ID: 6449473
FranzRinkleff, your code is good but not complete in that it does not auto close the window afterwards.

I believe user consent shouldn't really be a problem since the new window opens after a link is clicked instead of auto popup when the index page loads, etc. So the user expects a video anyways. What the user wouldn't expect might be a popup window. Therefore, kaushalshah, when you have found your code, be sure to let the user know the video will be in a new window instead of the current one. Many people hate popups including me.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 

Author Comment

by:kaushalshah
ID: 6454142
FranzRinkleff, I have tried your code but when the new window opens up to play the .avi file, the parent window goes blank with on "[object]" written on it.   Am I missing something?
0
 
LVL 4

Expert Comment

by:daluu
ID: 6462226
kaushalshah,

FranzRinkleff's code may have a javascript conflict with the HTML code. See, the url for href="url" in the hyperlink is the javascript code. The javascript code will work but the parent window will go to the javascript code when the user clicks the link. (How can anyone go to a javascript code? - its not a url or page)

Here is a good solution which I have used to overcome that problem before. Try this hyperlink code:

<a href="theparentwindowurl" onclick="window.open('aviWindow.html','newAviWindow','toolbar=0,menuBar=0,scrollbars=0,resizable=0,width=200,height=200,left=0,top=0');">Click here for popup AVI movie.</a>

Then use the same embed code.

With this code, the new window pops up when the link is clicked and the parent window will just refresh itself.

FYI toolbar=0 means no toolbar, so toolbar=1 means yes. left and top specifies where the window will be located (in pixels) based on the reference point of the upper left corner of the screen.

If you don't like a refreshing parent window, you will need to use pure javascript without the hyperlink which will make the supposed link to not look appear as a link.

I can also post you code for pure javascript or closing the popup window upon request. But I suggest that it is simpler to let the user click the close button on the window instead and to use the code I have posted above.
0
 
LVL 1

Accepted Solution

by:
FranzRinkleff earned 80 total points
ID: 6462395
Sorry I did not respond sooner.  I have not been reading much of my mail lately.  

I inverted two values in my previous message.

use the following

in the file called aviWindow.html put the following link

<a href="javascript:window.open('newAviWindow.html', 'aviWindow', 'width=200, height=200')">Play AVI
File</a>

in the file called newAviWindow.html

put the following

<embed src="locationofAviFile.avi" loop="2" autostart="true"</embed>

the attributes kaushalshah placed in his javascript to open a new window are pretty useful.  However you can just do the following as well to make it show the toolbar, the location bar, be resizable or have scrollbars.  a little less typing and i find easier to read. when i use pop-up windows i usually like to remove the location and toolbars. i also can find pop-ups annoying but usually only if they are ads.  i often find them useful when i am processing a form or something which i do not want the user to use the back button or change the location by accident.  

<a href="javascript:window.open('newAviWindow.html', 'aviWindow', 'width=200, height=200' height=575 toolbar, location, resizable, scrollbars')">Play AVI
File</a>


0
 
LVL 4

Expert Comment

by:daluu
ID: 6465592
If you don't care about the window size and location of the new popup window, and whether there are toolbars, scrollbars, etc., you can use this hyperlink code instead. It's much simpler and less typing:

<a href="aviWindow.html" target="_blank">Click
here for popup AVI movie.</a>

then in aviWindow.html, use the same embed code.

This will essentially do the same thing without javascript and the object error.

Last, if you do care about window size/location, toolbars, etc., and you want a link without reloading the parent window, you can use a form button or form image input instead of the hyperlink. I can post code for that too if you want.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6629533
This question has been abandoned.  I will make a recommendation to the
moderators on its resolution in a week or two.  I appreciate any comments
that would help me to make a recommendation.

Cd&
 
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6694643
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to FranzRinkleff

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 4

Expert Comment

by:daluu
ID: 6695424
I don't want to seem harsh but FranzRinkleff's hyperlink code is not very aesthetic as one can conclude according to the user, kaushalshah's reply to FranzRinkleff above and through thorough testing.

In the follow up reply, FranzRinkleff did not answer the user's question regarding "the parent
window goes blank with on '[object]' written on it" problem. The code basically neglect's the parent window url change, as all hyperlinks must do. A simple href="#" in the hyperlink would have solved the problem.

Therefore, I wouldn't call FranzRinkleff's comments a satisfactory solution.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6696277
The original question is answered, and for 20 points you can expect a lot of followup.

Cd&
0
 

Expert Comment

by:ComTech
ID: 6696366
Answer accepted by:

ComTech
Community Support
0

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question