Open local PDF on iOS


#1

Hi

I am hoping this question has a very simple answer.

I am trying to open a local PDF on iOS only using the following:

<a class="item" href="#" onclick="window.open('/pdf/Venue_Event_Plan.pdf', '_blank', 'location=no', 'EnableViewPortScale=yes', 'closebuttoncaption=Return'); return false;">
    Open PDF
</a> 

It opens up the inappbrowser window but it is blank. I can open web links with no problems but not PDFs even if they are web based.

I get the following error in the iOS simulator:
webView:didFailLoadWithError - -1003: A server with the specified hostname could not be found.

thanks in advance Mark


#2

Are you sure this location is correct?

Remember, relative links are the safest route.


#3

Yes I think so @Gajotres, it is sitting in a pdf folder within the www folder.


#4

Why don’t you try using relative links?

For example:

./pdf/Venue_Event_Plan.pdf

or

././pdf/Venue_Event_Plan.pdf

until you reach your pdf directory


#5

@Gajotres thank you very much thats all I needed. I was using two . instead of one.

Many thanks again for such a quick response


#6

I’m glad to be of help :slight_smile: