jeudi 26 mars 2015

Form target=iframe, but server returns foo.txt file that initiates download

I have an old-school form that I post, setting target=hidden_iframe so the server response it displayed in said hidden_iframe.


Everything works fine except the server returns foo.txt, which the browser typically decides to download (Firefox, Chrome) or refuse to display (IE: This content cannot be displayed in a frame).


The desired behavior is for the foo.txt, which is actually json, to end up in the iframe so that that the contents of said iframe can be sent elsewhere using the onload() event.


Yes, I know this is a job for ajax, but ajax is impossible in this situation do to unfavorable CORS settings on the server.


So



  • How to force the iframe to display/load the foo.txt?

  • Failing that, is there a way to force the browser to execute a script through the target= attribute?


Aucun commentaire:

Enregistrer un commentaire