473,807 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

attach stylesheet to iframe in Firefox (relative URI)

Hi all,

I have a problem in attaching an external stylesheet to a newly created
iframe in Firefox (1.5.0.2).
If I use the code below (with a relative address to the file) the
stylesheet would not be applied.
I have to indicate the absolute path:
var uriStylesheet = "http://localhost:8080/panel/styles.css";
to make it work in Firefox.
NB: if I try to attach the external stylesheet to the topmost body (the
main document) I could use the relative path without a problem.

any ideas?

greetz

mord

<html>
<body>
<script>

oPanel = document.create Element("IFRAME ");
oPanel.src = "about:blan k";
document.body.a ppendChild(oPan el);
oPanel.addEvent Listener("load" , function(){
var oImage = oPanel.contentD ocument.createE lement("IMG");
oPanel.contentD ocument.body.ap pendChild(oImag e);
attachStyleshee t();
}, false);

function attachStyleshee t(){

var uriStylesheet = "/jPanel/styles.css";
var uriStylesheet = "http://localhost:8080/panel/styles.css";
var oStylesheet = oPanel.contentD ocument.createE lement("LINK");
oStylesheet.rel = "stylesheet ";
oStylesheet.typ e = "text/css";
oStylesheet.hre f = uriStylesheet;
var oHead = oPanel.contentD ocument.getElem entsByTagName(' head')[0];
if(oHead){
oHead.appendChi ld(oStylesheet) ;
}
}

</script>
</html>
</body>

Apr 16 '06 #1
3 5516
i donot now any thing i from K.S.A

Apr 16 '06 #2


ju************@ chello.at wrote:

I have a problem in attaching an external stylesheet to a newly created
iframe in Firefox (1.5.0.2). oPanel = document.create Element("IFRAME ");
oPanel.src = "about:blan k";


Well what do you expect the browser to do with a relative URL if you
simply load about:blank in the window/frame? To resolve a relative URL a
base URL is needed but a document loaded from about:blank does not
really have one. Load a normal http: or file: URL in the frame and then
the browser is able to resolve a relative URL.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 16 '06 #3
Martin,

I thought the path of the onwner document was taken into consideration
in this case (IE seems to do this), well I was quite "IE-way-thinking"
and wrong. Thanks for clarification

lg

mord

Apr 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2344
by: Stéphane Mottelet | last post by:
Hi. How do you specify the document()'s arguments when the name of the document you want to load is obtained as a string, e.g. concat(@base,'.xml') ? The problem is that if the path of the xsl stylesheet is /some/path/, and @base contains
3
12824
by: allard poldermans | last post by:
How can I make a reference to an external CSS or JS file that is relative to the XSL stylesheet, and not relative to the XML data? If you simply put : <link rel="stylesheet" type="text/css" href="ui/demo.css" ></link> in your XSL file, this link will always be relative to the location where the XML file is. For example, suppose I have following XML data (test.xml):
24
4503
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html with a link to http://www.domain2.com/page2.html you can abbreviate the second link as //www.domain2.com/page2.html
1
4688
by: Martial Spirit | last post by:
Hello- I was amazed at the suckerfish drop-downs from AListApart.com. They work great except for one thing, if I position the drop-downs over an iframe element, on mouseover the menus disappear. It works fine in IE, but not FireFox. I would like to implement these menus, but if I can't get this to work, I gotta look at something else. If anyone has some suggestions, I would appreciate it.
7
2711
by: Vincent van Beveren | last post by:
Hi everyone I have a JavaScript app that creates an IFRAME through DOM (createElement('IFRAME')) However, that IFRAME does not have any content yet. alert(iframe.contentWindow.document.documentElement) gives null.
4
28012
by: christine.nguyen | last post by:
Hello, Here's the deal. I have an html page that contains an iframe. This iframe has an id that is unknown to me. This iframe also has test.html as it's source. Within test.html runs some javascript. Within this javascript that runs in test.html, I want to obtain the id of the iframe that loaded test.html in the first place. Is this possible?? I have no control over the iframe at all. The iframe will be loaded on some random html...
8
2607
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the path can take the form of the following: 1. /directory/images/xyz.gif (works fine) 2. http://localhost:1234/www.mytestwebsite.com/directory/images/xyz.gif (doesn't work) 3. http:///www.someremotesite.com/directory/images/abc.gif (doesn't work)
1
4560
by: IframeLearner | last post by:
Hi , I am trying to upload a file from a parent.jsp using Iframes. From Parent page. I have to save Subject, Desc, File and file name. to upload the file i am using Iframe. I want the iframe to save file in the Db and come back to parent page with file name in the form of the parent , so that i can save the parent after updaing other details. I am able to save the file in the DB and come back to parent page. While coming back...
2
1544
by: Paulson | last post by:
HI all I got a problem with my menu display.I am making a list as shown below in one of my aspx pages. And added a stylesheet in CSS for it. This is not working in IE but not in Mozilla Firefox it is working. Can anyone please help me with this? Just after the page html I pasted my CSS stylesheet code also. __________________________________________________________________
0
9599
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,...
1
10374
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,...
0
10111
tracyyun
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...
0
9193
agi2029
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...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5684
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3853
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.