PDA

View Full Version : Firefox ignores my custom javascript ..



Tatonka
21 Dec 2011, 1:54 PM
Hi Guys,

I working on a new project involving a ruby on rails server with an ExtJS frontend. I am currently trying to add an additional panel to the view (which is basically an independent HTML page). I got everything working, by including

items : [{
region: 'center',
scripts: true,
autoLoad: {
scripts: true,
url: '/foo/index.html'
},
minHeight: 200,
minWidth: 600
}]

When I look at the page in Chrome, everything is working fine (except some very annoying caching/update problem). So I moved to Firefox (8.01) and here none of the custom Javascript included in the included file is working anymore. Not even a simple alert in the main page. As said, it works fine when using another browser and even in Firefox when opening the included page directly .. only the ExtJS include seems to disable any javascripts, despite the scripts: true parameter.

I am at the end of my wisdom and would really appreciate somebody giving me a little push in the right direction. I already tried enabling detail Error and Warnings in Firebug .. but there seems to be nothing there either.

As said, any help, hint or even idea is greatly appreciated.

Thanks
T.

skirtle
21 Dec 2011, 2:29 PM
The loader is intended to bring in small snippets of HTML. By the sounds of it you want to embed a totally different page, which is better achieved using an IFRAME.

Why it doesn't work in FF I don't know. You may want to try inspecting the elements created using Firebug to see if that sheds any light on the problem.

Tatonka
22 Dec 2011, 12:48 AM
Hi Skirtel,

thanks for the reply. The "website" I try to include is essentially a single canvas element with a bunch of js files.

From an iframe, can I still access the parent Ext objects?
What is best practice to include custom javascript files in an ExtJS / Rails environment?

Again, thanks for the help.

T.

skirtle
22 Dec 2011, 11:00 PM
The "website" I try to include is essentially a single canvas element with a bunch of js files.

For that I think the loader should be OK. Make sure you're just including an HTML fragment in your response. Don't wrap it in tags like <html><body>...</body></head>.

Perhaps you could try to extract a simple test case that you can post on this thread?


From an iframe, can I still access the parent Ext objects?

So long as the iframe URL satisfies the same-origin policy it can interact with the outer page but they will have separate global namespaces, so you can't just type Ext and expect it to reference the outer page.


What is best practice to include custom javascript files in an ExtJS / Rails environment?

I don't think I understand the question. Not sure there's anything specific to ExtJS in that regard.

Tatonka
17 Jan 2012, 10:23 PM
Hi,

sorry for the late reply and again thank you very much for your help. I never got the problem actually fixed, but thought I'll share my "solution" anyways.

I couldn't quickly compile a short example showing the problem, so I ended up replacing the autoload with a regular box element. Not sure what went wrong in Firefox there.

Thanks
Tim