iPad - cannot scroll inside frame

16,522

Solution 1

According to this article http://support.apple.com/kb/ht1484 you cannot scroll anything inside a frame when using Safari on the iPad. The frames always get resized to fit their content (this also applies to iframes). To do this, Safari even dismisses the values for "cols" or "rows" you made in the frameset-tag and seems to use whatever value is needed. Unfortunately, the frame does not resize properly for PDFs so they get cut off.

I think your best choice might be to link the pdf directly...

Solution 2

I think the problem is that you are trying to display a PDF. The 2-finger swipe approach should work for regular HTML frames.

One option is to use Google Docs Viewer (http://docs.google.com/viewer) in your application.

Share:
16,522
copenndthagen
Author by

copenndthagen

Buy some cool JavaScript related merchandise from; https://teespring.com/stores/technical-guru-2

Updated on June 25, 2022

Comments

  • copenndthagen
    copenndthagen almost 2 years

    I cannot scroll a pdf called inside a frame in iPad Safari

    <frame src="ebook.pdf" title="Content Frame" name="content" id="content" 
    frameborder="0" border="0" noresize scrolling="yes" marginwidth="0" marginheight="0" 
    noresizescrolling="AUTO" framespacing="0" /> 
    

    I have already tried 2 things:

    1. 2-finger scroll
    2. Using object/embed instead of frame

    But this does not work.

    In fact I have tried a lot of things...overflow, height, etc..

    Please help me. Thank you in advance.

  • copenndthagen
    copenndthagen almost 13 years
    First of all, thanks a lot for taking the time out and suggesting a solution...I have 2 questions for the approach suggested by you;
  • copenndthagen
    copenndthagen almost 13 years
    Yes right..Linking the PDF directly would work..But unfortunately I'll not be able to do that in my current app..
  • Steve Kelly
    Steve Kelly almost 13 years
    hmm, I didn't realize you were using the pdf as a src for the iframe. I don't think my method would work then. Is it not possible to export the PDF as an image and place it inline? Then this method would work. Sorry!
  • copenndthagen
    copenndthagen almost 13 years
    I didn't quite understand what exactly do you mean by exporting the PDF as an image..Are you saying just a jpg and then create a link to the actual pdf..If that is what you are trying to say, I'll not be able to do that, as the "src" attribute val is dynamic i.e. different pdfs get loaded in the same frame dynamically, based on where the user comes from..
  • lpd
    lpd almost 13 years
    If you use an iframe instead of a frameset, would it possible to use JavaScript post load to readjust the height of the iframe back to the desired value so the entire pdf is visible on the page at once?
  • Philipp Horn
    Philipp Horn almost 13 years
    This should be possible if you find a Javascript-library for receiving the height of the PDF. I don't know if there is such a thing...but I never searched :) Maybe there is a solution in PHP (or whatever language you want to use)
  • copenndthagen
    copenndthagen almost 13 years
    I did try finding online if the PDF height can be calculated dynamically...But not found anything yet...Do you know any way of doing that using Javascript?
  • Philipp Horn
    Philipp Horn almost 13 years
    No, sorry, I din't find anything either. Does it has to be client-side or can you use some server-side stuff too...like converting the pdf to an image with PHP and get the height of that image...might be overkill though :)
  • copenndthagen
    copenndthagen almost 13 years
    Hey...here is what my findings are...using iframe, i can scroll through the pdf..though works only in older ios..think 3.2....But the same does not work in the latest ios...4.3
  • copenndthagen
    copenndthagen almost 13 years
    Yes right..But as I said, using <iframe>, i can scroll through the pdf..though works only in older ios (think 3.2)....But the same does not work in the latest ios...4.3
  • copenndthagen
    copenndthagen almost 13 years
    Also I am a bit aprehensive of using Google Docs Viewer ..I mean is it completely free to use for commercial purpose ?
  • lensovet
    lensovet almost 12 years
    Sorry but that's not what the article says. It says that the scroll bars are hidden and that you must use a two-finger gesture to scroll up/down. Unfortunately this only works on frames with HTML inside them and not PDFs.
  • Philipp Horn
    Philipp Horn almost 12 years
    Well...it says both...which is a little bit confusing because why would you want to scroll in a frame that is "expanded to fit its content"?! By the way: did apple manage to solve this whole issue yet?