0

I'm using to fallback to default image if there is no concrete image for current item. This is working properly for firefox and even for IE8+ but chrome always display default image.

<object style="display: inline-block; width: 226px; height: 340px;" data-bind="attr: { data: ImageUrl }">
    <img style="display: inline-block; width: 226px; height: 340px;" src="~/Content/images/default.png" />
</object>

to be honest I don't know even where to start searching for issue.


If JavaScript is not enabled you can combine them server-side.

You cant do this without JavaScript enabled, if they are different fields you need script to get their values and concatenate them.

4

1 回答 1

0

这是因为您必须指定 type 属性,这似乎对 chrome 是强制性的。

<object style="display: inline-block; width: 226px; height: 340px;" data-bind="attr: { data: ImageUrl }" type="image/png">
    <img style="display: inline-block; width: 226px; height: 340px;" src="~/Content/images/default.png" />
</object>

试试这个说明问题解决方案的小提琴:http: //jsfiddle.net/SEYwf/

于 2013-08-12T14:44:19.570 回答