Iframe Relative Paths Challenge

I have a page and inside the page I have an Iframe. The directory is as follows:

Folder1
   Folder2
      IframeCSS
          IframeCSS.Css
      iframePage1.html
stuff.css
parentPage1.html

In iframePage it is referenced IframeCSS.Cssusing a relative link, therefore/IframeCss/IframeCSS.Css

Due to the nature of the application, I cannot change the link to the iframe page using hard code (changing the physical iFrame Html page)

The overall goal is to get iframePage1.htmlto see IframeCSS.Css(and all other hrefs / src's) through relative links ( href="/IframeCSS/IframeCss.Css")

There are a few things I've tried:

  • Dynamically add base iframe path

    This failed because the base can only be added after loading the iframe, so the links act as if the base does not exist

  • Iframe, HTML, Iframe

    - , , API Google.

  • iframe, jquery, src hrefs, URL

    .

, , ?

(iframe , iframe)

HTML:

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link rel="stylesheet" href="cmsCSS/CmsStyle.css" />
    <title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="CmsScript.js"></script>
<script src="Insights.js"></script>
</head>

<body id="Dash">

    <form id="form1" runat="server">
    <div id="topDash">
        <img id="something" src="img/logo.png" />

    </div>

    </form>
         <iframe id="dashBody"></iframe>
         <iframe id="iframeContainer"></iframe>
</body>
</html>
+4
3

, iframe :

Folder1
   Folder2
      IframeCSS
          IframeCSS.Css
      iframePage1.html
stuff.css
parentPage1.html

, domain.com/Folder1/Folder2/IframePage1.html , IframePage1.html css :

href="/IframeCSS/IframeCss.Css"

, domain.com/IframeCSS/IframeCss.Css , , .

, , - Hrefs src iframePage domain.com/IframeCSS/IframeCss.Css, domain.com/Folder1/Folder2/IframePage1.html .

Folder2 , parentPage1.html. , .

+1

, -

href="IframeCSS/IframeCss.css"

? "/" . , "../" . , , "../" (: "../../../stuff.css" ).

+1

, iFrame, <head> CSS. .

, . . JavaScript .

. . iframePage1.html , iFrame . parentPage1.html.

iframePage1.html <html>, , iframe.

, . , .

google.com iframe , , .

,

, iframe , iframe.

, , .

JSFiddle

, , , -,

, -, .

I thought you could navigate in an iframe, but I was WRONG , but with Sandboxing you can do it !!!!

0
source

All Articles