Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25478
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Images and pdf in a div |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <lqc77u$ljp$1@dont-email.me> <lqdl2u$45o$1@solani.org> <lqds4k$iad$1@dont-email.me> |
| Date | 2014-07-19 15:51 +0200 |
| Message-ID | <XnsA36FA164733A9eejj99@194.109.133.133> (permalink) |
danca <cyberdanny@tiscalinet.it> wrote on 19 jul 2014 in
comp.lang.javascript:
> Il 19/07/2014 13:34, Christoph M. Becker ha scritto:
>> danca wrote:
>>
>>> When the thumbnails points to a PDF, however, I have to change the div,
>>> particularly I:
>>> -create a new embed node
>>> -use replaceChild to switch the node image with the newly created node
>>> embed.
>>> I could anyway go another route:
>>> create the two nodes and simply give display:none to alternatively the
>>> image and the embed node, without the use of replaceChild.
>>>
>>> Has someone an idea about cross-browsers issues with the first approach?
>>> It works with all the (main, modern) browsers on a pc. Android browser
>>> is OK too, but I'm unsure about iPads and iPhones (and I have no one to
>>> test with).
>>
>> I don't see any problems regarding the replacement of the node (i.e.
>> your first approach).
>>
>> However, the embed element surely requires a PDF reader/renderer to be
>> available in the browser (e.g. the Adobe Acrobat plugin). If that is
>> not available, the browser likely will render an empty space or maybe an
>> error message. Perhaps it is reasonable to display a preview image
>> instead of the PDF document.
>>
> It is unclear to me how to detect preliminarly the availability of the
> plugin, or which syntax to use to have a fallback to a preview image.
> I am a bit puzzled with this idea, it sounds good but I would greatly
> appreciate a hint.
> My basic code is something like this:
> ...
> var oldNode=document.getElementById("doc")
> var newNode=document.createElement("embed")
> newNode.type="application/pdf"
> newNode.src="http://"+location.host+"/images/test.pdf"
> oldNode.parentNode.replaceChild(newNode,oldNode)
> newNode.id="doc" // ready for another substitution - same id as previous
> ...
> then I resize the div container etc.
> So... what kind of feature must I look for?
Google is your friend, I hope:
<http://thecodeabode.blogspot.nl/2011/01/detect-adobe-reader-plugin.html>
I did not test this, btw.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Images and pdf in a div danca <cyberdanny@tiscalinet.it> - 2014-07-19 00:31 +0200
Re: Images and pdf in a div "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 13:34 +0200
Re: Images and pdf in a div danca <cyberdanny@tiscalinet.it> - 2014-07-19 15:34 +0200
Re: Images and pdf in a div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-19 15:51 +0200
Re: Images and pdf in a div danca <cyberdanny@tiscalinet.it> - 2014-07-19 18:30 +0200
Re: Images and pdf in a div Andrew Poulos <ap_prog@hotmail.com> - 2014-07-20 15:23 +1000
Re: Images and pdf in a div Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-20 12:42 +0200
Re: Images and pdf in a div danca <cyberdanny@tiscalinet.it> - 2014-07-20 20:07 +0200
Re: Images and pdf in a div Andrew Poulos <ap_prog@hotmail.com> - 2014-07-21 14:10 +1000
Re: Images and pdf in a div danca <cyberdanny@tiscalinet.it> - 2014-07-21 14:19 +0200
Re: Images and pdf in a div Andrew Poulos <ap_prog@hotmail.com> - 2014-07-21 08:14 +1000
Re: Images and pdf in a div Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-21 02:00 +0200
Re: Images and pdf in a div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-21 07:15 +0200
Re: Images and pdf in a div Osmo Saarikumpu <osmo@weppipakki.com> - 2014-07-24 18:26 +0300
Re: Images and pdf in a div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-24 17:48 +0200
Re: Images and pdf in a div Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-07-24 22:32 +0100
Re: Images and pdf in a div "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-24 23:58 +0200
Re: Images and pdf in a div "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-24 18:40 +0200
Re: Images and pdf in a div Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-25 12:31 +0200
Re: Images and pdf in a div John Harris <niam@jghnorth.org.uk.invalid> - 2014-07-25 15:52 +0100
csiph-web