0

I generate HTML content and store on a blob which I then need to display in an IFrame. This HTML has been static HTML but now my pages use a bit of JavaScript generated by a 3rd party (it only acts on the page itself). With IE this JavaScript is blocked in the IFrame (it’s not a problem in Chrome) - thus I need to find a solution so the content in the IFrame is not blocked.

One approach I am consider is to serve this up with a CustomHandler. Thus, my handler can handle request that starts with “/blob” and then download the content (HTML pages or images) from the blob and server it up so it appears to the browser that it was from the same server. Is this a good approach to take here?

If yes, then should ProcessRequest simply download the (HTML or image) and save it to the context.Response.OutputStream (with the ContentType set accordingly). What is the best way to get the data from the blob and serve it up?

Mister Cook
  • 1,552
  • 1
  • 13
  • 26

1 Answers1

0

Don't use an iframe for your own content. If you want a scrollable area, do it with CSS:

.containerContentScroll {  overflow: auto;  height: 500px;  scrollbar-base-color: #963; }

Also, all Azure blob content can be referenced by URL, you could just do:

<iframe src="http://myblob.blob.core.windows.net/.../image.png />

Finally, if you need the iFrame and cross-domain scripting see this SO post for how to enable it in MVC and this article on the XDomainRequest object.

UPDATE - just found Cross Origin Resource Sharing (CORS) via Access-Control-Allow-Origin header is a planned feature for Azure Storage - VOTE here.

Community
  • 1
  • 1
viperguynaz
  • 12,044
  • 4
  • 30
  • 41
  • Thanks for suggestions but I can't use a div. This is because the HTML is generated by a 3rd party component and this includes tag. It would be too tricky to restructure the HTML each time. As for iframe src, this is what I am doing already but the problem is that IE blocks the JavaScript in the IFrame because it is on a differet domain. – Mister Cook Mar 11 '13 at 15:58