/    Sign up×
Community /Pin to ProfileBookmark

error accessing location object of frame

hi everyone,

sorry for the primitiveness of this post but this is probably the easiest way to explain my problem.

  • 1. i am having a problem with setting the location of an iframe.

  • 2. my setup is one frame with an iframe inside (pretty obvious though, right?).

  • 3. iframe SRC causes a page not found to be displayed.

  • 4. main frame notices this and wants to reset the iframe location.

  • 5. the retrieval of iframe receives an “Access is denied”/”Permission denied” JS error.
  • any clues on how i can get around this? i just want to reset the location of that iframe.

    yeaaaah, any help would be greaaaayt. thaaaaaaaaanks. ?

    to post a comment
    JavaScript

    7 Comments(s)

    Copy linkTweet thisAlerts:
    @TheBearMayNov 29.2005 — If we can see a small sample of the code, we may be able to speak a little more intelligently to issue, but in general if an element has an id you can access it using document.getElementById("idValue"), thus document.getElementById("idValue").src can be used to reset the location.
    Copy linkTweet thisAlerts:
    @bgreel00authorNov 29.2005 — i know you can do that. the problem is actually accessing the SRC value of the iframe once the iframe contains the IE error page with the following message:

    "The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. "

    it might be an issue of differing domains because the error page is obviously in a different domain than all my other pages. is there a way to assign a new iframe object to the iframe with the error page using javascript?
    Copy linkTweet thisAlerts:
    @konithomimoNov 29.2005 — Why not just have a textbox (that has its display set to hidden) that you send the desired SRC to before you load that page into the iframe? That way you can always see what page was supposed to be loaded. Of course that will only work for pages that are on your domain.
    Copy linkTweet thisAlerts:
    @bgreel00authorNov 29.2005 — that wont help. i already know the SRC of that iframe. i just want to do reload on that iframe. [B]the problem is when i try to access the location object of the iframe in javascript i get a permission denied error[/B] (maybe a side effect of the page not found). thanks though.
    Copy linkTweet thisAlerts:
    @konithomimoNov 29.2005 — There is no location attribute of an iframe. There is only an src attribute. Location and SRC are completely different.
    Copy linkTweet thisAlerts:
    @bgreel00authorNov 29.2005 — i slipped. sorry. i meant SRC attribute. when i try to access the SRC attribute i get a permission denied.
    Copy linkTweet thisAlerts:
    @engtatDec 02.2005 — Hi,

    I have the same problem like you during my development. After hours of researching, I found out this is browser problem. I guess you are using Internet Explorer 6

    This is new restriction set by Microsoft IE, you cannot access another frame's method/objects. You will find other browser like Firefox actually works like a charm.
    ×

    Success!

    Help @bgreel00 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.28,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...