I have a WYSIWYG editor based on the HTMLArea project that uses the
cssRules object of a stylesheet to add/update stylesheet rules for
table cells. Ever since I upgraded to FireFox 1.5, I get the following
error message when trying to access the cssRules object:
"Access to restricted URI denied"
The code I am trying to execute looks like this:
var currStyleSheet = editor._doc.sty leSheets[0];
var currRules = currStyleSheet. cssRules;
var tdIndex = currRules.lengt h;
for(i = 0; i < currRules.lengt h; i++) {
if(currStyleShe et.cssRules.ite m(i).type == 1) {
//if it is a style rule
var currRule = currRules.item( i)
if (currRule.selec torText.toLower Case() == "td") {
tdIndex = i;
}
}
}
This code is simply looking for any rules for TD elements. I am at a
loss as to what is going on and/or what changed if FireFox to cause
this error. It worked fine in previous releases of FireFox. The
document that I am trying to access the stylesheet for is within an
IFRAME, which is what I believe is causing the problem. Thanks. 19 4420
mephraim wrote: I have a WYSIWYG editor based on the HTMLArea project that uses the cssRules object of a stylesheet to add/update stylesheet rules for table cells. Ever since I upgraded to FireFox 1.5, I get the following error message when trying to access the cssRules object:
"Access to restricted URI denied"
The code I am trying to execute looks like this:
var currStyleSheet = editor._doc.sty leSheets[0]; var currRules = currStyleSheet. cssRules;
Does the error message not name the exact line number causing the error?
which line is that, the attempt to access
editor._doc
or the attempt to access
currStyleSheet. cssRules
What is the URL of the HTML document with the script, what is the URL of
the iframe? As the error message says "Access to restricted URI denied"
seeing the URIs could help.
--
Martin Honnen http://JavaScript.FAQTs.com/
The error occurrs on the line with the following:
var currRules = currStyleSheet. cssRules
I am able to read the stylesheet, but it throws that error when I try
to access cssRules.
I am running this page on a development server
( http://niagara.leepfrog.com/), and the IFRAME is populated with a
series of iframe.document .write() calls, not a SRC. It works when I
try to access cssRules from the main Document sylesheet, but throws the
error when I try to access cssRules in the IFRAME from the Main
Document. Hopefully this clears thins up a little bit.
mephraim wrote: The error occurrs on the line with the following:
var currRules = currStyleSheet. cssRules
I am able to read the stylesheet, but it throws that error when I try to access cssRules.
I am running this page on a development server (http://niagara.leepfrog.com/), and the IFRAME is populated with a series of iframe.document .write() calls, not a SRC.
Do you still experience the problem? Do you have a URL with the example?
--
Martin Honnen http://JavaScript.FAQTs.com/
mephraim wrote: I have a WYSIWYG editor based on the HTMLArea project that uses the cssRules object of a stylesheet to add/update stylesheet rules for table cells. Ever since I upgraded to FireFox 1.5, I get the following error message when trying to access the cssRules object:
"Access to restricted URI denied"
The code I am trying to execute looks like this:
var currStyleSheet = editor._doc.sty leSheets[0]; var currRules = currStyleSheet. cssRules; var tdIndex = currRules.lengt h; for(i = 0; i < currRules.lengt h; i++) { if(currStyleShe et.cssRules.ite m(i).type == 1) { //if it is a style rule var currRule = currRules.item( i) if (currRule.selec torText.toLower Case() == "td") { tdIndex = i; } }
}
Uhmm... and who told you that ever worked for Firefox at all? Did you
get yours from mozilla.org ?
Presuming that your style sheet has an ID (the only way to work
reliably with Firefox) and this ID is say "myCSS" then:
document.getEle mentById('myCSS ').sheet.cssRul es[0].style.backgrou ndColor;
and so on...
Works just fine since 1.0.4
VK wrote: mephraim wrote: I have a WYSIWYG editor based on the HTMLArea project that uses the cssRules object of a stylesheet to add/update stylesheet rules for table cells. Ever since I upgraded to FireFox 1.5, I get the following error message when trying to access the cssRules object:
"Access to restricted URI denied"
The code I am trying to execute looks like this:
var currStyleSheet = editor._doc.sty leSheets[0]; var currRules = currStyleSheet. cssRules; var tdIndex = currRules.lengt h; for(i = 0; i < currRules.lengt h; i++) { if(currStyleShe et.cssRules.ite m(i).type == 1) { //if it is a style rule var currRule = currRules.item( i) if (currRule.selec torText.toLower Case() == "td") { tdIndex = i; } }
} Uhmm... and who told you that ever worked for Firefox at all?
It is specified so.
Did you get yours from mozilla.org ?
Obviously you did not.
Presuming that your style sheet has an ID (the only way to work reliably with Firefox)
Nonsense, Firefox (i.e. the Gecko DOM) provides the document.styleS heets
collection (a reference to a StyleSheetList object) accessed here as
specified in W3C DOM Level 2 Style.
and this ID is say "myCSS" then:
document.getEle mentById('myCSS ').sheet.cssRul es[0].style.backgrou ndColor; and so on...
Nonsense:
Works just fine since 1.0.4
Of course it does not. A CSSStyleSheet object referred to by the return
value of document.getEle mentById() here does not have a 'sheet' property
at all. What would also work instead is
document.getEle mentById('myCSS ').cssRules[0].style.backgrou ndColor;
However this required an ID while the document.styleS heets collection did
not. Unfortunately as usual, the information you provided is factually
flawed and therefore potentially harmful to others.
PointedEars
Thomas 'PointedEars' Lahn wrote: However this required an ID while the document.styleS heets collection did not. Unfortunately as usual, the information you provided is factually flawed and therefore potentially harmful to others.
as usual 2 months of experiments are defited by one specs reading...
VK wrote: Thomas 'PointedEars' Lahn wrote: However this required an ID while the document.styleS heets collection did not. Unfortunately as usual, the information you provided is factually flawed and therefore potentially harmful to others.
as usual 2 months of experiments are defited by one specs reading...
What are you babbling about? The Gecko DOM does _not_ specify nor
_implement_ a `sheet' property for CSSStyleSheet objects. However, it has
specified _and_ has _implemented_ the document.styleS heets collection ever
since.
<URL:http://developer.mozil la.org/en/docs/DOM:style>
If your tests showed the opposite, then your tests are flawed. Which would
not be surprising, though.
PointedEars
On 28/01/2006 17:36, Thomas 'PointedEars' Lahn wrote: VK wrote:
[snip] Uhmm... and who told you that [styleSheets and cssRules collections] ever worked for Firefox at all?
It is specified so.
Quite right, though more importantly, it is implemented as such (since
at least Moz 1.3 - the earliest Gecko browser I have available at the
moment).
[snip]
Nonsense, Firefox (i.e. the Gecko DOM) provides the document.styleS heets collection (a reference to a StyleSheetList object) accessed here as specified in W3C DOM Level 2 Style.
Again, very true.
[snip]
A CSSStyleSheet object referred to by the return value of document.getEle mentById() here does not have a 'sheet' property at all.
An object implementing the CSSStyleSheet interface does not have a sheet
property, as you say, but a LINK or STYLE element that references a
cascading style sheet doesn't implement the CSSStyleSheet interface
directly. Instead, they both implement the LinkStyle interface, which
only has one property, sheet (and that does implement the StyleSheet
interface).
What would also work instead is
document.getEle mentById('myCSS ').cssRules[0].style.backgrou ndColor;
You should have tested that; it doesn't (though I'm guilty of the same
charge on occasions when I'm feeling lazy :-/).
[snip]
It seems to me that this should be a security issue: the OP is trying to
access style sheet rules from an IFRAME element that isn't part of the
same domain (from the description, there's no URL). That said, I thought
security issues started when trying to access the document object[1].
Mike
[1] I don't 'do' frames, so I'll plead ignorance, here. It's a
potential starting point, though.
--
Michael Winter
Prefix subject with [News] before replying by e-mail.
On 28/01/2006 20:30, VK wrote:
[snip] as usual 2 months of experiments are defited by one specs reading...
It took you two months to conclude that the Gecko DOM doesn't support
the styleSheets collection, when in fact it does?
Mike
--
Michael Winter
Prefix subject with [News] before replying by e-mail. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christopher Benson-Manica |
last post by:
Supposedly IE implements the cssRules property for a stylesheet. So
why is the word 'foo' in the below page red and not blue?
<html>
<head>
<style>
.foo { color: #ff0000; }
</style>
</head>
<body>
|
by: Derek Erb |
last post by:
I am banging my head against the wall with this one. The following
code snippets work perfectly fine in MSIE6. But produce an error in
Firefox and do not work at all.
BROWSER.HTM
<HTML>
....
<div class="Abb">
<h2 id="ABTit">BROWSER</h2>
</div>
|
by: lkrubner |
last post by:
We are working on a website that is here:
http://www.lauradenyes.com/
The site was working till I put up an .htaccess file that was suppose
to redirect all html files to the PHP parser. The site then stopped
working, because I had the address of the PHP parser wrong. I then
deleted the .htaccess file, and the site began to work again. However,
on one machine it still does not work in FireFox.
|
by: David Blickstein |
last post by:
I have some XML documents that I want to open in a web browser and be
automatically translated to HTML via XSLT. I'm using an xml-stylesheet
processing command in a file called "girml.xml".
This all works in Internet Explorer, but doesn't work with Firefox.
In both IE and Firefox this works:
<?xml-stylesheet type="text/xsl" encoding="UTF-8" href="makehtml.xslt"
version="1.0"?>
|
by: PlainDave |
last post by:
Hi,
Is there a way to make windows tooltips stay up longer than the default
5 seconds using CSS in a web page? I'd prefer to have it stay visible
as long as the mouse is over the "whatever." The reason: I've been
creating web pages and using various javascripts for the tooltip
popups, and they are fine and very "tweakable." But, I'd prefer to just
use the "title" and/or the "alt" attribute and somehow alter it so that
viewers to my...
| |
by: puja |
last post by:
hi all,
I have an asp.net website where am including .css file dynamically on page
load event. For diff users, there is diff CSS file. So after user logs in, I
am setting CSS href on page load. My CSS file works fine in IE 6.0 when i
specify the absolute path. eg- href ="D:\Mywebsite\css\mycssfile.css" but
this full path does not work in firefox 1.5.0.5. When I load page in
firefox, css file seems to have no effect on page.
If I...
|
by: entfred |
last post by:
I have the following line of html:
 1234  abc  yow
In Internet Explorer 6.0, the columns look ok using the above html:
1234 abcd yow
But, in firefox, for same html, getting this:
|
by: Stever1975 |
last post by:
I'm working on something similiar to a shopping cart item page. There
is a table of items. Each item has an image, a textbox for the qty
and an image for the add button.
When the add image is clicked it adds the item to the cart array and
sums it if the item already exists in the cart.
This code works perfectly fine in Internet explorer and firefox, heck
I even tested it in chrome and it works.
So everything works fine in all browsers...
|
by: lorlarz |
last post by:
Sparkline Graphs no longer work in Firefox. I am pissed. Does anyone
care?
Here is what used to run in FireFox 1.5 and 2, but no longer works in
Firefox 3 (not on PC or Linux anyway). Anyone will pals at Mozilla,
please
nudge them.
http://mynichecomputing.com/digitallearning/QuickGraphsES.html
http://mynichecomputing.com/digitallearning/MiniGraphsES.html
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |