How to know if the iframe content is html or json on load event
问题 I have an event handler function bound to the load event of an iframe, and I want to know if the content retrieved inside the iframe is HTML or JSON. Is there a way to achieve this? 回答1: After some research, the most feasible way I found to know which kind of content is loaded in the iframe is trough the contentType/mimeType properties of the document DOM element. We can get this property in different ways: Inside the load handler function (way 1): var iframedocument = $(this).contents().get