Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8067561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:19:59+00:00 2026-06-05T12:19:59+00:00

Today I upgrade my Firefox to 13.0. But something goes wrong with my javascript

  • 0

Today I upgrade my Firefox to 13.0. But something goes wrong with my javascript code.

There’s a webpage A(www.xx.com) and webpage B(webim.xx.com). I embed B in A using iframe tag.

webpage A

first set the domain as ‘xx.com’

<script>document.domain = 'xx.com';</script>

then create an iframe to load webpage B.

<script>
var iframe = document.createElement('iframe');
document.body.insertBefore(iframe, document.body.firstChild)
iframe.src = 'http://webim.xx.com';
</script>

webpage B
set the domain as ‘xx.com’

<script>document.domain = 'xx.com';</script>

Then I access the localStorage of webpage B.

On webpage A, execute code:

window.iframe.contentWindow.localStorage.setItem('a', 'a')

Then an error will be given:

Error: The operation is insecure.

In the previous versions or other browser, the code can execute normally.

Anybody knows why?

It’s a bug?

And.. How to solve this problem? Thx.


Just now I found a way to fix this problem.

I can’t access the localStorage directly, but I can call the function of the iframe which can call the localStroage of its own webpage.

/// webpage B
<script>
document.domain = 'xx.com';
var ls = { ///< ls is short for localStorage.
    setItem: function(k, v) {
        return localStorage.setItem(k, v);
    },
    getItem: function(k) {
        return localStorage.getItem(k);
    },
    removeItem: function(k) {
        return localStorage.removeItem(k);
    },
    clear: function(){
        return localStorage.clear();
    }
}
</script>

Then I call ls.setItem etc. to access the localStorage of the iframe.

/// webpage A
<script>iframe.ls.setItem('a', 'b');</script>

Even though I can solve this problem, why firefox 13.0 cause this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:20:00+00:00Added an answer on June 5, 2026 at 12:20 pm

    The old Firefox behavior was buggy, and the bug got fixed. Per spec, setting document.domain should have absolutely no effect on the behavior of localStorage, so in your case you’re trying to set localStorage for a different domain, which is not allowed.

    See https://bugzilla.mozilla.org/show_bug.cgi?id=495337 and the localStorage spec for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I came across this question: you have a code static int counter =
Today I was tracking down a floating point exception in some code I had
today I'm trying to optimize my website for a better rendering in firefox! my
Today I stumbled upon the possibility to access a DOM element in Javascript simply
Today I was creating new instances and I noticed something weird on it. I
Is there a fundamental difference between how position:fixed; is handled by Firefox 3.0 and
I haven't upgrade my gems for a long time, just today, I decided to
I was using Html.RouteLink(LINKTEXT,RouteName,new RouteValueDictionary()) in asp.net MVC beta without problem, today I upgrade
With NHibernate 3 going GA today, I was wondering if I can upgrade a
I started today to upgrade my iPhone-App to an Universal-App. So I'm using Xcode

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.