English 中文(简体)
Loading of IMDB posters using JQuery not working
原标题:

I wrote a small utility which helps compare films using an (un-official) API available at imdbapi.com

The api even returns the path of the film poster which I intend to display on my page. The issue that I am running into is that even though the element is created correctly along with the correct path, I get a blank placeholder when I deploy the site online in place of the image.

The images load up while testing on localhost - but don t work online.

Another weird part is that if I have already searched for a film locally and hence have the image cached, that shows up while searching for the same film online - but new posters don t load up.

The source code and everything is online at: http://compovie.com

It s completely in JS - no server side scripting used.

This is really driving me nuts and any help would be appreciated. I have tested this and behaviour repeats in FF 3.6, IE8 and Chrome.

Thanks.

-- Edit 19-Feb-2010 --

The PHP script snippet that I used to get this to work is:

header( Content-Type: image/jpeg );
if(isset($_GET["imgUrl"])) {
    $img = file_get_contents($_GET["imgUrl"]);
        echo $img;
}
最佳回答

Traced using firebug and looks like imdb restricts access to images based on HTTP_REFERRER. Response given below:

<HTML><HEAD>
<TITLE>Referral Denied</TITLE>
</HEAD><BODY>
<H1>Referral Denied</H1>
You don t have permission to access "http&#58;&#47;&#47;ia&#46;media&#45;imdb&#46;com&#47;images&#47;M&#47;MV5BMjA3NDI4ODUwMF5BMl5BanBnXkFtZTcwOTgxOTkyMQ&#64;&#64;&#46;&#95;V1&#46;&#95;SX320&#46;jpg" on this server.<P>
Reference&#32;&#35;24&#46;362e0660&#46;1296452290&#46;2e4450a
</BODY></HTML>
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签