Quantcast
Channel: Active questions tagged frames - Stack Overflow
Viewing all articles
Browse latest Browse all 67

detecting location.href in a frame

$
0
0

I am running into a problem on some computers accessing my website when a function call attempts to detect the location.href for a frame, while there is no problem in changing the value. The frame in question might point to different sites, which can be manipulated by clicking on an option in another frame via a call like the following:

parent.frames[0].location.href="http://www.foo.com/bar.html";

which works fine in all cases and changes the frame to the appropriate location. Subsequent attempts to verify if it is in a specific location fail for some users however. I attempt to verify the current frame location via:

if(parent.frames[0].location.href == "http://www.foo.com/bar.html"){    return true;}

for some of my users however, this causes an error which crashes the frame, and is shown in firefox browser (under web developer/error console) as "unable to detect location.href". Yet it works fine for other users using the exact same browser.

My question:

  1. Is there a setting which is causing this error that the client could set to allow checking of location.href values?
  2. Is there a more robust way to check a location which would work despite settings?

The only thing I saw in a web search which looked related was a program called "firebug", but my user's client is not using this program.


Viewing all articles
Browse latest Browse all 67

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>