# Downloading a .mobi file from a website



## Liz in PA (Dec 29, 2010)

Hello,

I received a Kindle DX for Christmas, so not very familiar with it yet!

One of the first things I wanted to do is to download a document created at work to be available to the public. Clicking on the link did not result in a download. I was able to email the .mobi file to my Kindle with no problem, so I assume the file is OK?

It's unclear to me if I SHOULD be able to download directly from the website, or if I need to do something to make it work. The .mobi file is located near the bottom of this page:

http://www.landscapes2.org/plan/Plan.html

Thank you,
~Liz K


----------



## Jeff (Oct 28, 2008)

I was able to download the file. What happens when you try?


----------



## Elk (Oct 4, 2010)

The Kindle will not, in my experience, download a file directly from within its built-in browser.  The browser is not this sophisticated.

The user needs to do as you did; either download the file and email to a Kindle or transfer it to a Kindle via USB.


----------



## Jeff (Oct 28, 2008)

Elk said:


> The Kindle will not, in my experience, download a file directly from within its built-in browser. The browser is not this sophisticated.
> 
> The user needs to do as you did; either download the file and email to a Kindle or transfer it to a Kindle via USB.


I'm not sure about the Kindle 3 but I've downloaded numerous Mobipocket files with the K1. It pops up a message asking if you're sure then installs the file very neatly.


----------



## Liz in PA (Dec 29, 2010)

Jeff,

Basically, nothing happens when I try. If I click the PDF link, a message comes up, but nothing happens when I click the .mobi link. Just to be clear, you tried the link on the page I mentioned and it worked?

~Liz


----------



## Jeff (Oct 28, 2008)

Liz in PA said:


> Jeff,
> 
> Basically, nothing happens when I try. If I click the PDF link, a message comes up, but nothing happens when I click the .mobi link. Just to be clear, you tried the link on the page I mentioned and it worked?
> 
> ~Liz


Yes, I clicked the link, Landcapes2 Mobi (for Kindle) and was able to download the file. Maybe you need to have an application installed that can read Mobipocket files like Kindle for PC/Mac or Mobipocket reader.


----------



## ff2 (Oct 20, 2010)

I could use some clarification from both sides.

Are you trying to download using the Kindle's browser or a computer?

I understand some sites work well with the kindle and will actually allow a file to be downloaded directly using the kindle's browser and make the book accessible on the kindle whereas other sites will not allow such direct actions from the kindle.

I know in reading that someone mentioned that the Project Gutt... mobile site does work directly from the kindle.  I think Mobilereads also has a "book file" or catalog that allows direct downloading.


----------



## Liz in PA (Dec 29, 2010)

ff2,

Yes, I am trying to download directly from the website acessed throught my Kindle. We would like to make it as easy as possible for the public to download documents from our website.

Jeff,

I shouldn't need another application if a pc/mac isn't part of the equation, should I?


I truly appreciate all the help I'm getting so quickly!


----------



## Jeff (Oct 28, 2008)

Liz in PA said:


> Jeff,
> 
> I shouldn't need another application if a pc/mac isn't part of the equation, should I?
> 
> I truly appreciate all the help I'm getting so quickly!


I didn't try it with my Kindle but I assume if you can't get it, I can't either.

Does your server have the Mobipocket MIME type (application/x-mobipocket-ebook) registered?


----------



## Liz in PA (Dec 29, 2010)

Jeff,

I'm trying to figure out if it's "supposed" to work.

I'll have to check with the web person about the Mobipocket MIME type (application/x-mobipocket-ebook) registration. Thanks for the tip.

~Liz


----------



## Jeff (Oct 28, 2008)

Liz,

There seems to be a bug in the K3 browser that pops up a window saying that only *.MOBI, *.PRC and *.TXT files can be downloaded. It even happened when I navigated to a PRC file on my own web server, so it looks as if the issue is beyond your control.


----------



## Elk (Oct 4, 2010)

Liz in PA said:


> I'm trying to figure out if it's "supposed" to work.


The Kindle's browser does not have the ability to open a second window within the browser. Thus, it cannot download a file from a webpage in the way a computer does.

There may be a clever way around this, but I don't know what it is.

Update: Jeff's experience is interesting. This implies there is something that would work. It may be that the server must immediately start sending (without asking for confirmation) the file when the button is clicked when using a Kindle.


----------



## Jeff (Oct 28, 2008)

Elk said:


> The Kindle's browser does not have the ability to open a second window within the browser. Thus, it cannot download a file from a webpage in the way a computer does.
> 
> There may be a clever way around this, but I don't know what it is.
> 
> Update: Jeff's experience is interesting. This implies there is something that would work. It may be that the server must immediately start sending (without asking for confirmation) the file when the button is clicked when using a Kindle.


Last year I created a PRC file with hyper-links to other PRC files. The user could click on the link while reading the master file and download another file directly to the Kindle. It worked with previous versions of the Kindle but I haven't tried it with a K3. I will before the day's over.


----------



## Jeff (Oct 28, 2008)

I just tried the above with my K3 and it generates the same error. It works with a K1.


----------



## NogDog (May 1, 2009)

Geek alert!

It would appear that the web server must be configured to serve it up with an appropriate MIME type. I.e., it's not just a case of having the right file name suffix. If you cannot change the server settings (such as via a .htaccess file if Apache), you might be able to make a little file server script to set the "Content-Type" HTTP header. If someone needs help setting this up, I could probably assist.


----------



## Jeff (Oct 28, 2008)

NogDog said:


> Geek alert!
> 
> It would appear that the web server must be configured to serve it up with an appropriate MIME type. I.e., it's not just a case of having the right file name suffix. If you cannot change the server settings (such as via a .htaccess file if Apache), you might be able to make a little file server script to set the "Content-Type" HTTP header. If someone needs help setting this up, I could probably assist.


The MIME type is configured on my server. Here's the test file that I created if you're interested. It links to my novella.

http://www.eliscopublishing.com/This is a test of the K3.prc


----------



## NogDog (May 1, 2009)

Jeff said:


> The MIME type is configured on my server. Here's the test file that I created if you're interested. It links to my novella.
> 
> http://www.eliscopublishing.com/This is a test of the K3.prc


I just ran a little cURL script via PHP to access that URL, and I get a MIME type of "text/html".


```
HTTP/1.1 200 OK
Cache-Control: private
Date: Mon, 03 Jan 2011 18:06:57 GMT
Content-Length: 628
Content-Type: text/html   <<------------<<<<<
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
Set-Cookie: ASPSESSIONIDQABDQSAB=NFDDLHABDKJFHIKOJGALODML; path=/
```


----------



## Elk (Oct 4, 2010)

Very cool, NogDog and Jeff!


----------



## Jeff (Oct 28, 2008)

NogDog said:


> I just ran a little cURL script via PHP to access that URL, and I get a MIME type of "text/html".


There are two MIME types set on the server:

.prc application/x-mobipocket
.epub application/epub+zip


----------



## NogDog (May 1, 2009)

I was led astray a bit as to the problem here. In the OP's case, the problem is that the web page uses a *target="_blank"* attribute in the link <a> tag, which is what the Kindle browser is rejecting. That attribute will open a new window in older browsers, or a new tab in most recent browsers -- but not in the K3's browser. Therefore the link will work fine on your PC, but your Kindle won't play nicely with it, just as Jeff's link won't work on your Kindle from this forum, as Kindleboards similarly sets a new target for user-supplied links.


----------



## Liz in PA (Dec 29, 2010)

NogDog,

Are you saying the answer is as simple as fixing the link on out webpage to NOT open in a new window/tab?

~Liz


----------



## NogDog (May 1, 2009)

Liz in PA said:


> NogDog,
> 
> Are you saying the answer is as simple as fixing the link on out webpage to NOT open in a new window/tab?
> 
> ~Liz


Yes. I think you just need to remove that "target" attribute.


----------



## Liz in PA (Dec 29, 2010)

NogDog,

Thanks so much! I won't be able to fix that till tomorrow, but look forward to making this work.

~Liz


----------



## Jeff (Oct 28, 2008)

NogDog said:


> ...just as Jeff's link won't work on your Kindle from this forum, as Kindleboards similarly sets a new target for user-supplied links.


Well if that's the problem we can fix it by using IURL tags instead of URL tags:

http://www.eliscopublishing.com/This is a test of the K3.prc

Does that work?


----------



## NogDog (May 1, 2009)

Jeff said:


> Well if that's the problem we can fix it by using IURL tags instead of URL tags:
> 
> http://www.eliscopublishing.com/This is a test of the K3.prc
> 
> Does that work?


I don't get the "cannot open a new window" error on my K3, but it now complains about the file type not being AZW, PRC, MOBI, or TXT. Therefore that seems to confirm my earlier test that your server is sending a "text/html" MIME type header, not the "application/x-mobipocket-ebook" or similarly applicable MIME type.


----------



## Jeff (Oct 28, 2008)

NogDog said:


> I don't get the "cannot open a new window" error on my K3, but it now complains about the file type not being AZW, PRC, MOBI, or TXT. Therefore that seems to confirm my earlier test that your server is sending a "text/html" MIME type header, not the "application/x-mobipocket-ebook" or similarly applicable MIME type.


I don't know anything about script. This is all I can add:

If I remove the application/x-mobipocket-ebook from the sever the file won't download at all. If the MIME type is set to application/x-mobipocket-ebook the file downloads to a PC or a K1 as a Kindle file. It errors out on the K3 no matter what I do?


----------



## NogDog (May 1, 2009)

Afraid I'm not much on M$ Server/IIS. All I know is when I access that URL, the response header says text/html, not the MOBI mime type. How/where are you setting the mime type for .mobi files?


----------



## Jeff (Oct 28, 2008)

NogDog said:


> Afraid I'm not much on M$ Server/IIS. All I know is when I access that URL, the response header says text/html, not the MOBI mime type.


I think your script is returning the header not the MIME type of the target. It works perfectly on everything I own except a K3. Have you tried it on a computer?



> How/where are you setting the mime type for .mobi files?


The MIME type gets set in the IIS control panel.

Edited to add: Over a thousand people have downloaded PRC files from my server in the last 2 weeks.


----------



## NogDog (May 1, 2009)

Jeff, can you change the MIME type to "application/x-mobipocket-ebook". That's what feedbooks.com is using, anyway. Here is a comparison of response headers (I'm now seeing yours as "application/x-mobipocket", so maybe I had a typo and was getting the 404 Not Found page as HTML).


```
[b]Test: Jeff[/b]

HTTP/1.1 200 OK
Date: Mon, 03 Jan 2011 19:59:30 GMT
Content-Length: 2952
Content-Type: application/x-mobipocket
Last-Modified: Mon, 03 Jan 2011 17:53:50 GMT
Accept-Ranges: bytes
ETag: "345d9e2d6fabcb1:20a3f9"
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET


[b]Test: feedbooks
[/b]
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 03 Jan 2011 19:59:32 GMT
Content-Type: application/x-mobipocket-ebook
Connection: keep-alive
Status: 200
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.2
ETag: "de9fb1a2f29fabb09cc5dd779f2c7af9"
Content-Transfer-Encoding: binary
Content-Disposition: attachment; filename="Charles Stross - Accelerando.mobi"
X-Runtime: 189
Content-Length: 1194681
Set-Cookie: _sn=BAh7BjoPc2Vzc2lvbl9pZCIlZDg4MzZhMDQzMWE1ZTVmNDM1ZDliZWU4NWVjNDliMzA%3D--a7eb1ff35c84139335aef706ce202b4b10e55aaa; domain=.feedbooks.com; path=/; HttpOnly
Cache-Control: private
```


----------



## Jeff (Oct 28, 2008)

NogDog said:


> Jeff, can you change the MIME type to "application/x-mobipocket-ebook". That's what feedbooks.com is using, anyway. Here is a comparison of response headers (I'm now seeing yours as "application/x-mobipocket", so maybe I had a typo and was getting the 404 Not Found page as HTML).


Okay, Charles, I changed it and added .mobi as application/x-mobipocket-ebook.


----------



## NogDog (May 1, 2009)

Jeff said:


> Okay, Charles, I changed it and added .mobi as application/x-mobipocket-ebook.


That's the ticket: successful download on my K3.


----------



## Jeff (Oct 28, 2008)

NogDog said:


> That's the ticket: successful download on my K3.


Ah, good job. Now let's hope that Liz can do the same.


----------



## Liz in PA (Dec 29, 2010)

PROBLEM SOLVED!

Thanks to all for a really helpful discussion, and especially NogDog for the winning suggestion! We changed the link to NOT open in a new window, and I was able to navigate to the page above from my Kindle, and download the document, which only took about a minute.

~Liz


----------



## NogDog (May 1, 2009)

Liz in PA said:


> PROBLEM SOLVED!
> 
> Thanks to all for a really helpful discussion, and especially NogDog for the winning suggestion! We changed the link to NOT open in a new window, and I was able to navigate to the page above from my Kindle, and download the document, which only took about a minute.
> 
> ~Liz


Glad to hear it. I even put a note about it on my blog, as it all seems non-intuitive enough that others will need this info.


----------



## Elk (Oct 4, 2010)

Excellent!


----------

