I'm trying to embed vimeo videos posted on a tumblr page to my new website. To do this, I'm reading the video source information from the json file of the tumblr page which can be accessed via http://vimeo.tumblr.com/api/read/json
and then trying to append it to my web page using jquery. However, it seems like chrome interprets the //player.vimeo.com link to be a local directory and not the website! What should I do about this?
Here is essentially what I have right now
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<div id="helloWorld"></div>
<script type="text/javascript" src="Karen/jquery.js"></script>
<script type="text/javascript" src="http://vimeo.tumblr.com/api/read/json">
</script>
<script type="text/javascript">
for (var i=0; i<5; i++){
var link = tumblr_api_read.posts[i]["video-source"]
$("div#helloWorld").append(link + "<br>");
}
</script>
</head>
</html>
EDIT: sorry for any confusion, I was trying to solve a problem I was facing when the video-sources were wrapped in an iframe, and caused the browser to look for file://player.vimeo.com....
I was able to solve the problem by doing this
var link = tumblr_api_read.posts[i]["video-source"];
if (link){
link = link.replace("//player", "http://player")
$("div#helloWorld").append(link + "<br>");
}
//
is relative: it will point using the protocol that is appropriate for the task at hand: if you are testing this webpage locally, //
is always going to point to file://
. If you were doing this online, it would use either http://
or https://
, depending on the protocol of the resource you are accessing.
To fix this, just be explicit about the protocol you'd like to use, be it http
or https
.