[Solved] Failed to load pdf in chrome when downloading with PHP

Sometimes you struggle with issues that seem to be small at first glance but still consume a lot of time to find out what the real problem is especially when the issue can only be reproduced when a specific browser or version is used. In my case I build a script to download a PDF file in PHP. It seemed to work in all browsers until a client uploaded a very specific PDF file that wouldn’t open in chrome’s buildin PDF viewer but worked in all other browsers and also offline. Ahhhrr is it a chrome bug, or did I do something wrong? Continue reading to find out what I did to solve it.

Continue reading

Cross Domain Ajax with Cookies support using jQuery

Ajax requests are only possible when the protocol, domain and port number are the same. But sometimes you want to do Ajax calls to a different domain for example when you are creating a shared service that people should be able to call using Ajax or when you are developing locally and you are testing on a remote server. There are multiple ways to get around this restriction for example by using  CORS, an iFrame or JSONP. In my last project I got around the restriction using JSONP, so I will explain that here. See links for more information about solving it using CORS.

Continue reading