View Full Version : Ajax Tabs Content script - PDF files and use of iframes

09-14-2007, 01:28 PM
1) Script Title: Ajax Tabs Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem: I a trying to call an external PDF file, but all I get is a jumble of meaningless characters. Are PDF files not supported in Ajax?

Second problem: using an iframe to embed an external page (e.g. from another domain or one with rich javascripts), the page does not display inside the iframe unless I specify the full URL (e.g. http://locahost/path/etc). However, this is a pain because it prevents portability - e.g. I am developing on my local PC using localhost and when I upload it to the server, the URL will need to be changed (and this is a problem because I will have over 20 such references).

Any workarounds ?

09-14-2007, 07:04 PM
Pdf are binary files that require a plugin to view, so I'm not surprised it doesn't work when fetched via Ajax, which probably just results in a garbled binary mess, similar to if you try open the file in a text editor.

The second issue doesn't really have much to do with this script, but with the behavior of iframes in general. Unless the relative paths to the target page is exactly the same on both your local machine and web server (minus the http://localhost/ and http://www.mysite.com/) part, you'll need to use an absolute URL to make it work.

09-17-2007, 09:04 AM
Thanks for the reply about PDF. However, my point with the iframes is that it does not work unless I specify an absolute path. Relative paths are not working. My local site is a complete mirror of the server. The page with the iframe works if I open it independently of Ajax, which suggests that it is not an error in my code but ajax that is breaking the iframe code.

From your reply, it seems that this shouldn't happen. Hence, any idea why it is breaking?