Question

A question like this was asked before and the person got nothing but criticisms, hope this won't be the case here.

I have a website that allows a business to add their menu to my site, and some have requested to be able to import a menu (a pdf or jpg) that is already online elsewhere. So I made a form that saves a url to the db and then that url is used in the src of an iframe on my site.

I tested it all and it worked fine on my local machine (using Django development server). When I synced it over to my production server and saved the same url I was testing with, the iframe loads no content.

I imagine that it has something to do with trying to read an individual file from another server because it works if I make the url google.com or to an image that is under my domain name. Is there anything I can do to fix this? Storing a url instead of a pdf in my db is much more efficient so doing this way is preferred over uploading their menu to my site.

I don't think this question needs any code attached, but if you want to see some let me hear it.

Thanks

Was it helpful?

Solution

The menu you're testing with probably has the X-Frame-Options response header set.

Is there a reason you're putting the image/pdf as the src on an iframe instead of just using the img tag (or putting an img tag inside your iframe)? There's still no guarantee that will work for all pages, as some sites will refuse to serve media to an external page, but I suspect this is your problem in this case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top