John Beasley
John Beasley

Reputation: 3071

Open PDF in window without URL using jQuery

I am not sure if this is possible, but can a PDF be opened in a window without a URL?

I've seen sites where an additional window will open like a pop-up, and it will not have an address bar.

If this is possible with JQuery, how can I edit my code to make this happen:

$('#resultsTable').on('click', 'tr > td > .openPDF', function()
{
  var $dataTable = $('#resultsTable').DataTable();
  var tr = $(this).closest('tr');
  var rowData = $dataTable.row(tr).data();

  var rowBookingNum = rowData.JOB_REFERENCE;
  var partnerCode = rowData.SHIPPER_CODE;

  // path to PDF
  var pdf = '../PartnerUploads/' + partnerCode + '/' + rowBookingNum + ".pdf";  

  $.get(pdf)
  .done(function() 
  {
    window.open(pdf); 
  }).fail(function(textStatus)
  {
    if(textStatus.status == 404)
    {
      return false;
    }
  });
});

Upvotes: 0

Views: 1056

Answers (1)

John Beasley
John Beasley

Reputation: 3071

I came across this site: https://pdfobject.com/

Really simple to use. Solved my problem.

Upvotes: 1

Related Questions