views:

253

answers:

1
  1. Is iframe should not be used ever?

  2. how screen reader behaves with iframed content?

  3. Without iframe how we can embed any PHP page into asp.net based site?

  4. What are cross browser alternatives?

+3  A: 

I don't see why using an iframe is a problem.
If you can't use it then you could either use javascript to download and insert the generated html from the php page, or you could download the html in your asp.net server-side code and insert the html in a control.
Either approach should work well, but using javascript across domains is difficult.

If you go for the asp.net server-side approach you could do the following:

  • First insert an control where you want to include the html from the php page
  • In your Page_Load event use the WebClient to download the html as a string
  • Remove the <html>, <head> and <body> tags so that you only have the pure html markup. You may want to add any script- and css-references to your page if they are needed.
  • Assign the cleaned html to the Label controls Text property.

This will work, but there are a few points to make:

  • First you should consider if you trust the source of the php page. If you don't then you will want to do some extra cleaning of the html before displaying it
  • Second, you will probably want to cache the downloaded html so that you don't have to download it for each page view.
Rune Grimstad