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?

2
  • if you own and generate the content, why would you ever use an iframe? Mar 11, 2013 at 4:52
  • My site design requires this content to be displayed in its own scrollable area Mar 11, 2013 at 10:37

1 Answer 1

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.

1
  • 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 <HTML> 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. Mar 11, 2013 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.