当我通过手机点击网址时如何下载pdf?

时间:2017-06-30 19:07:22

标签: laravel iframe bootstrap-modal

我创建了一个组织记录的应用程序,列表中有一些pdf链接,当我通过计算机访问域时,pdf在新选项卡中打开,一切正常,但是当我从手机访问时(Android)特别是)下载文件。有没有办法阻止这个下载?我想过使用显示内容的iFrame,但首先我想知道是否有其他方法可以解决这个问题。

我的pdf网址

<table class="table">
          <tr>
            <th>Data</th>
            <th>Nº Pedido</th>
            <th>Cliente</th>
            <th>Valor</th>
            <th>Pedido</th>
            <th>Serasa</th>
            <th>Histórico</th>
            <th>Status</th>
            <th></th>
          </tr>
          @foreach($orders as $value)
          <tr>
            <td>{{date_format($value->created_at,'d-m-Y')}}</td>
            <td>{{$value->ph_pedido}}</td>
            <td>{{substr($value->ph_cliente,0,15)}}...</td>
            <td>R${{ number_format($value->ph_valor, 2, '.', '')}}</td>
            <td><a href="{{$value->ph_urlpdf}}" target="_blank" data-toggle="tooltip" data-placement="top" title="Clique para acessar"data-toggle="tooltip" data-placement="top" title="Tooltip on top">@if($value->ph_urlpdf == null)<img src="https://s3-sa-east-1.amazonaws.com/comercio-urbano/Product/marcas/tycoontech/647716-pdf-24.png"> @else <img src="https://cdn3.iconfinder.com/data/icons/document-icons-2/30/647716-pdf-24.png" alt="">@endif</a></td>
            <td><a href="{{$value->ph_urlserasa}}" target="_blank" data-toggle="tooltip" data-placement="top" title="Clique para acessar">@if($value->ph_urlserasa == null)<img src="https://s3-sa-east-1.amazonaws.com/comercio-urbano/Product/marcas/tycoontech/647716-pdf-24.png"> @else <img src="https://cdn3.iconfinder.com/data/icons/document-icons-2/30/647716-pdf-24.png" alt="">@endif</a></td>
            <td><a href="{{$value->ph_historico}}" target="_blank" data-toggle="tooltip" data-placement="top" title="Clique para acessar">@if($value->ph_historico == null)<img src="https://s3-sa-east-1.amazonaws.com/comercio-urbano/Product/marcas/tycoontech/647716-pdf-24.png"> @else <img src="https://cdn3.iconfinder.com/data/icons/document-icons-2/30/647716-pdf-24.png" alt="">@endif</a></td>
            @if(Auth::user()->admin == 1)
            <td>
              @if($value->ph_approved == 1)
              <a href="orders/approve/{{$value->ph_orderid}}"><label class="label label-success">Aprovado</label></a>
              @elseif($value->ph_approved == 0)
              <a href="orders/approve/{{$value->ph_orderid}}"><label class="label label-danger">Não aprovado</label></a>
              @elseif($value->ph_approved == 3)
              <a href="orders/approve/{{$value->ph_orderid}}"><label class="label label-warning">Pendente</label></a>
              @endif
            </td>
            @else
            <td>
              @if($value->ph_approved == 1)
              <label class="label label-success">Aprovado</label>
              @elseif($value->ph_approved == 0)
              <label class="label label-danger">Não aprovado</label>
              @elseif($value->ph_approved == 3)
              <label class="label label-warning">Pendente</label>
              @endif
            </td>
            @endif
            <tr>
            @endforeach
            </table>

有什么建议吗?提前谢谢!

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,如果我在链接之前添加代码http://docs.google.com/gview?embedded=true&url=,我会将链接重定向到Google文档并允许我查看文档而不是下载。