Monday, 28 March 2011

Firefox problem with iframe


I have HTML page (i.e. test.htm) in a website say (, the page is deeply located into a 3rd level folder, to access the page you have to write the URL as follows (http:/, test.htm has iframe element with src="/rootpage.aspx" like following:
<ifram src="/rootpage.aspx"></iframe>

The "rootpage.aspx" with another page named "primary.aspx" are located in the root folder of the website. And primary.aspx looks like the following:

<iframe src="/rootpage.aspx"></iframe>

If you open primery.aspx , it is normal to expect to see iframe of tset.htm that contain iframe of rootpage.aspx. That is true for all browsers except Firefox. Unfortunately, Firefox will give the following error:

The page cannot be displayed
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
Please try the following:
* Contact the Web site administrator if you believe this directory should allow execute access.
HTTP Error 403.1 - Forbidden: Execute access is denied.
Internet Information Services (IIS)
Technical Information (for support personnel)

I go to IIS&gt;&gt;website&gt;&gt;Properties&gt;&gt;HomeDirectory&gt;&gt;ApplicationSettings&gt;&gt;ExecutePermissions and make it Scripts and Executables. After that Firefox gave me the next error:

Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /l1/l2/l3/rootpage.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

From the last error message I understand that Firefox iframe.src property behaves differently than other browsers, I put "/" in front of the page name to tell the browser to go to root folder, but Firefox believes that root is relative to iframe context not browser context.

To solve the problem I modifed src="/rootpage.aspx" to become src="../../../rootpage.aspx"

Now everything goes right.

No comments:

Post a Comment