IE 11 does not render PDF in <object> tag

2,360 views
Skip to first unread message

deepa...@gmail.com

unread,
Oct 17, 2013, 2:21:49 PM10/17/13
to knock...@googlegroups.com
Hello,

I am having a SPA Durandal framework using Knockout. I have following <object> tag defined in .cshtml file to render PDF in the browser (Adobe X1 plugin is installed).
                        <object id="pdfDocument" data-bind="attr: { data: DocumentUrl() }"></object>

Through my view model, I am binding the DocumentUrl() observable as below:
            vm.DocumentUrl("http://courses.be.washington.edu/LARCH/440/FileType.pdf");

This does not work in IE 11. The document does not get rendered in <object> tag even though rendered HTML in browser has the URL in its "data" attribute.
However, when we have some sample/dummy PDF URL provided in the <object> tag's "data" attribute, then it works fine. i.e. 
                        <object id="pdfDocument" data="http://mysample.pdf" data-bind="attr: { data: DocumentUrl() }"></object>

It gets updated value of observable. Also, I tried adding type="application/pdf" attribute in <object> but it says, "Access denied" on the browser.

Any thoughts on this is greatly appreciated. 

Gunnar Liljas

unread,
Oct 17, 2013, 6:42:00 PM10/17/13
to knock...@googlegroups.com
It seems clear that's it's a browser anomaly, and nothing KO can do about it. What you could try (except for setting e.g "", "#" or "about:blank" as the dummy URL) is to  

 <div data-bind="html: DocumentHtml"></div>

where DocumentHtml is an computed observable returning the necessary markup. That way, the "object" will have a valid data attribute when it's added to the DOM. If that's IE 11's problem, that is....

/G



2013/10/17 <deepa...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

deepa...@gmail.com

unread,
Oct 17, 2013, 10:22:01 PM10/17/13
to knock...@googlegroups.com
Thanks for you reply. I tried your suggestion, however it didn't work. 

Gunnar Liljas

unread,
Oct 18, 2013, 2:36:21 AM10/18/13
to knock...@googlegroups.com
OK. Well, IE11 isn't ready yet. Report it to MS :)

/G

Rachel Silver

unread,
Oct 18, 2013, 10:26:50 AM10/18/13
to knock...@googlegroups.com
IE 11 seems to be having a lot of issues so far... I was fooling around last night with some of my code and was experiencing tons of random performance issues that weren't present in 10.

I find it greatly amusing that something that wasn't locking the UI in 10 now locks the UI for 5+ seconds in 11 -_-
Reply all
Reply to author
Forward
0 new messages