Претражи подршку

Избегните преваре подршке. Никада од вас нећемо тражити да зовете или шаљете поруке на број или да делите личне податке. Пријавите сумњиве радње преко „Пријавите злоупотребу” опције.

Сазнај више

Putting links to video files in web pages - want option "open with" when viewer clicks on links.

  • 7 одговорa
  • 1 има овај проблем
  • 76 прегледа
  • Последњи одговор послао Ponce

more options

If I go to a video file stored in my computer eg xyz.mp4 and right click on it, one of the options presented is "Open With" and several options eg QuickTime player, RealPlayer are presented for me to choose from. But when I add the file into a web page and create a link to it eg http://sillyvideos.com/xyz.mp4 and then I right click on that link (in the web page) in my Firefox browsers, I don't get the "Open With" option. My question is: is there a way to put a link to a video into a web page so I or other viewers can right click on it and be given the option "Open With" (so we can choose the player to open it, without having to download it first into our computers)?

If I go to a video file stored in my computer eg xyz.mp4 and right click on it, one of the options presented is "Open With" and several options eg QuickTime player, RealPlayer are presented for me to choose from. But when I add the file into a web page and create a link to it eg http://sillyvideos.com/xyz.mp4 and then I right click on that link (in the web page) in my Firefox browsers, I don't get the "Open With" option. My question is: is there a way to put a link to a video into a web page so I or other viewers can right click on it and be given the option "Open With" (so we can choose the player to open it, without having to download it first into our computers)?

Изабрано решење

Normally what happens is that the server sends the content with one or more headers which dictate what Firefox does with the video.

For example, if the content is sent with a header that Firefox can play internally, then Firefox may open the video in a tab and use a built-in player. You can see this with MP3s when the server says it is "audio/mpeg" content. On the other hand, if the server sends a content type that only a plugin can handle, Firefox may try to fire up that plugin.

Normally Firefox will assume the content is meant to be displayed in the browser, unless it is an unknown type or has a content disposition header set to "attachment". In those cases, Firefox usually presents the Open/Save/Cancel dialog.

I'm not sure what kinds of choices you wanted to offer your site visitors, but if you were thinking of giving them a choice of external players, sending with content-disposition:attachment to pop up the Open/Save/Cancel dialog probably makes the most sense. With more modestly sized files like JPEGs and PDFs, I have done this with a server-side script (e.g., a PHP script); I don't know whether the script would work with media files.

If you want to provide a wider choice, you might need individual buttons or links in the page.


This example is for a PDF, but the same idea applies to image files and it might work with larger media files. (In those cases, you edit the script to specify the correct content type.)

To implement the PHP approach, you would do the following. This assumes your webserver supports PHP (most do) and that your hosting allows you to upload PHP files.

(1) Save the following file under the name getpdf.php

http://www.jeffersonscher.com/res/getpdf.php.txt

(2) Using an FTP program or your server's upload feature, copy getpdf.php into the same folder as your PDF file

(3) Test with your link. In the address bar, or in an email, insert the following just before the name of the PDF:

getpdf.php?f=

So for example, this direct link to the PDF:

http://www.jeffersonscher.com/res/Mixed_Content_Blocking.pdf

would become this link to the PHP file:

http://www.jeffersonscher.com/res/getpdf.php?f=Mixed_Content_Blocking.pdf

Прочитајте овај одговор са објашњењем 👍 1

Сви одговори (7)

more options

Hi there! , I am here to help you.

Yes you can play video files directly on your website without even downloading them, to do this you have to embed a video player (for eg., vimeo) on your website.Multiple embedding can be done . But as far as i know, there are no such open to right click and select "open with" in a web browser.Hope this helps you.

Измењено од стране fiest

more options

Thanks fiest. Re "... as far as i know, there are no such open to right click and select "open with" in a web browser" - seems like a strange omission to me but maybe there's a good reason for it. Looks like I may need to develop my embedding skills.

more options

Glad it helped you. Any further question, please feel free to ask us any time. Take care.

more options

Одабрано решење

Normally what happens is that the server sends the content with one or more headers which dictate what Firefox does with the video.

For example, if the content is sent with a header that Firefox can play internally, then Firefox may open the video in a tab and use a built-in player. You can see this with MP3s when the server says it is "audio/mpeg" content. On the other hand, if the server sends a content type that only a plugin can handle, Firefox may try to fire up that plugin.

Normally Firefox will assume the content is meant to be displayed in the browser, unless it is an unknown type or has a content disposition header set to "attachment". In those cases, Firefox usually presents the Open/Save/Cancel dialog.

I'm not sure what kinds of choices you wanted to offer your site visitors, but if you were thinking of giving them a choice of external players, sending with content-disposition:attachment to pop up the Open/Save/Cancel dialog probably makes the most sense. With more modestly sized files like JPEGs and PDFs, I have done this with a server-side script (e.g., a PHP script); I don't know whether the script would work with media files.

If you want to provide a wider choice, you might need individual buttons or links in the page.


This example is for a PDF, but the same idea applies to image files and it might work with larger media files. (In those cases, you edit the script to specify the correct content type.)

To implement the PHP approach, you would do the following. This assumes your webserver supports PHP (most do) and that your hosting allows you to upload PHP files.

(1) Save the following file under the name getpdf.php

http://www.jeffersonscher.com/res/getpdf.php.txt

(2) Using an FTP program or your server's upload feature, copy getpdf.php into the same folder as your PDF file

(3) Test with your link. In the address bar, or in an email, insert the following just before the name of the PDF:

getpdf.php?f=

So for example, this direct link to the PDF:

http://www.jeffersonscher.com/res/Mixed_Content_Blocking.pdf

would become this link to the PHP file:

http://www.jeffersonscher.com/res/getpdf.php?f=Mixed_Content_Blocking.pdf

more options

Thanks scher2000 - I'll need to study your reply and do some experimenting and then I'll report back. Re "Normally Firefox will assume the content is meant to be displayed in the browser, unless it is an unknown type or has a content disposition header set to "attachment". In those cases, Firefox usually presents the Open/Save/Cancel dialog" - I'm keen to avoid the viewers being faced with the the Open/Save/Cancel dialog - fortunately the videos I'm putting into my web pages are pretty simple ones shot on common video cameras and with file types which are easily converted to another file type if needed.

more options

You would have to use an A tag and instruct users to right-click the link and use "Save Link As" to save the link. A left-click would make Firefox try to open the link in a tab and since Firefox can play MP4 files via the built-in HTML5 media player you won't get a open with (save) dialog. Getting such a dialog would require the server to send the file with a generic content type like "application/octet-stream".


more options

Thanks cor-el . I like "since Firefox can play MP4 files via the built-in HTML5 media player you won't get a open with (save) dialog" because it provides the option for Firefox users to bypass any dialogue box. Thanks to all three contributors - I'm on a steep and hopefully brief learning curve at present and you've provided me with good options and strategies I didn't know existed :-)