This is a migrated thread and some comments may be shown as answers.

iOS Open a PDF (or picture) in Safari

10 Answers 87 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Audrey
Top achievements
Rank 1
Audrey asked on 08 Apr 2013, 08:45 AM
Hello,
I can't open my documents in safari anymore ! Before I could, but now I can't, without changing my code :
<a id=\"LienDoc\" class=\"lien\"  href=\"" + Adresse + "\" rel='external' target='_blank'  >

Is this coming from the icenium debug on iPhone or is this something which has change ?

Best regards,
Aud'

10 Answers, 1 is accepted

Sort by
0
Audrey
Top achievements
Rank 1
answered on 09 Apr 2013, 08:19 AM
Is this possible that the problem came from the icenium way to launch the app ?
0
Steve
Telerik team
answered on 09 Apr 2013, 02:41 PM
Hi Audrey,

Could the problem you've hit and refer to be the one described in this forum thread: Opening external link not working properly with phonegap 2.4?

Regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Audrey
Top achievements
Rank 1
answered on 09 Apr 2013, 02:52 PM
Yeah it seems being the same one but the proposed solution doesn't work for me

                    window.open(myLink, '_system');
0
Steve
Telerik team
answered on 10 Apr 2013, 02:15 PM
Hi Audrey,

We can't reproduce this in our local tests. Can you create a new project and test only this particular functionality? If the issue only occurs in a specific application, can you post markup that we can use to reproduce the issue?

Kind regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Audrey
Top achievements
Rank 1
answered on 11 Apr 2013, 06:40 AM
Hi,
I already did it but it didn't work anymore..
I tried
<a href="" rel="external" target="_system">
and window.open(myLink, '_system');
But no one worked...
0
Audrey
Top achievements
Rank 1
answered on 11 Apr 2013, 09:56 AM
This part of code works fine :
                  document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
         var ref = window.open('http://www.cvc.u-psud.fr/IMG/pdf/Astronomie_AaZ.pdf', '_system', 'location=yes');
    }

BUT when I wanna open the link with an onclick event, it doesn't work anymore...

  <a id="lien" href="">ICI</a>    
        <script type="text/javascript" charset="utf-8">
              document.getElementById("lien").click(function () {
                  document.addEventListener("deviceready", onDeviceReady, false);
              });

   
    function onDeviceReady() {
         var ref = window.open('http://www.cvc.u-psud.fr/IMG/pdf/Astronomie_AaZ.pdf', '_system', 'location=yes');
    }

OR

document.getElementById("lien").click(function () {
         var ref = window.open('http://apache.org', '_system', 'location=yes');
    });

Any idea ??
0
Steve
Telerik team
answered on 12 Apr 2013, 08:36 AM
Hi Audrey,

Try any of the following:

<a id="lien"  href="">Click 1</a><br>
<a id="lien1"  href="">Click 2</a><br>
<a id="lien2" onclick="javascript:window.open('http://www.apache.org', '_system')"  href="">Click 3</a><br>
        <script type="text/javascript" charset="utf-8">
            document.getElementById("lien").onclick = function() {
                window.open('http://www.apache.org', '_system');
            };
             
            $("#lien1").click(function() {
                window.open('http://www.apache.org', '_system');
            });
        </script>


Regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Audrey
Top achievements
Rank 1
answered on 12 Apr 2013, 09:45 AM
hello, yes, thanks  it works fine but not everywhere !!!

Here's my html code generated by javascript using the jQuery function apprendTo :
"<a class=\"plsdocs\" onClick=\"Android('" + Adresse + "');\" >"

And the Android function :
function Android(href) {
                if (navigator.userAgent.match(/Android/i)) {
                    navigator.app.loadUrl(href, { openExternal: true });
                } else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i)) {
                    window.open(href, '_system');
                } else {
                    window.location = href;
                }
            }

This Android function works fine on the others pages but not here... Any idea ?
0
Steve
Telerik team
answered on 12 Apr 2013, 12:55 PM
Hello Audrey,

The code looks correct, our suggestion is to debug it and verify that:
  • the click event is fired
  • the argument passed to the function is correct

In general your question is not directly related to Icenium (which is basically the environment you work in) and you can get more thorough feedback about such general questions in community forums like StackOverFlow.

All the best,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Audrey
Top achievements
Rank 1
answered on 12 Apr 2013, 01:55 PM
Actually, it worked fine but the 3 fingers refresh didn't really worked at this time but now it's okay ! Thank you very much :D
Tags
General Discussion
Asked by
Audrey
Top achievements
Rank 1
Answers by
Audrey
Top achievements
Rank 1
Steve
Telerik team
Share this question
or