Solved

getURL Javascript not working in frames

Posted on 2003-11-14
6
676 Views
Last Modified: 2012-06-21
I have a flash movie that has to be in flash 5 (ungh).

It is in a page with two frames.
The frameset and the content in each of the frames are generated by JSPs, to which I have little access.

I cannot get the movie to properly call a javascript function from one of the frames when I target it to any of the frames in that frameset.  If I target a new window like '_blank' it works fine.

for example, this does not work:
getURL("javascript:alert('TEST!')","_self");
but this works fine:
getURL("javascript:alert('TEST!')","_blank");

When I hit the page by itself, outside of the frameset, it works fine.

When I view source, and take the HTML code generated by the JSPs, then save them locally on my machine, the flash and the javascript work fine, even in the frameset.

So, for some reason the javascript can't run javascript when targeted to the page it comes from, when they are built with the jsps.

Some wierd stuff that the site does:
The JSPs that build the frameset and the top frame are on one server, and the JSP that builds the frame with the flash is on a different server (both local).  There are 2 JSPs that build the frame with the flash, the first builds a session variable, then adds it as a parameter to the jsp that builds the actual page.

Well, that is a lengthy explanation, but I am sure that it still isn't sufficient info.

Has anyone ran into a similar problem and found what caused it?
0
Comment
Question by:ardivus
6 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9752253
this doesn't work, does it?

getURL("javascript:function(params)","frame_name");
0
 

Author Comment

by:ardivus
ID: 9752302
Nope.  In fact, it acts pretty funny,

When I try to target either of the frame names (the frame it is in, or the frame above it), it behaves just the same, like it can't do javascript.
Then, I broke it out of the frame, but kept the page open that had it in the frame.
When I tried it in the un-framed instance, it acted like it was framed still, until I closed the framed instance, then the same un-framed instance  started working.

I guess IE recognized that that frame name still existed until it was closed.


Another point of interest:
Everything works perfectly in Mozilla based browsers.  (I tried  Firebird, in Netscape 7.0, and in Netscape 4.7).
So far it is only a problem in IE.  I am running IE 6.0.2800.1106.
In IE I am using flash player 7.
0
 

Author Comment

by:ardivus
ID: 9765171
Here's more info:

I am just using alert() for testing purposes.
The real js function I am trying to call loads a page, and does a couple other things.

The real function (doLogin()) behaves the same as I have described for alert().  It works fine when the page isn't in frames, and when I copy the generated HTMl and run locally on my computer, but when the pages are generated by the JSPs, it clicks, but acts like it can't run javascript.

now, if I build a similar URL to what the javascript is doing, and use getURL() in the flash, rather than calling the javascript, it works everywhere fine.

On one person's IE browser, when they clicked on the link, it pulled up a "page can't be displayed" error, with "javascript:doLogin()" in the address bar.  For everyone else that tried it, it just clicks and doesn't do anything.

So... I am sure that getURL is working like it should.  Just for some reason, under certain circumstances it can't call javascript.  Unfortunately, I really need to be able to call the JS, and not go to the URL straight from the flash.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Accepted Solution

by:
troglo earned 500 total points
ID: 10255033
I had the same problem (our frame page was in a different domain than our flash page) and I´ll tell you the way we solved it, is a bit strange (but it worked for us, so good luck). In brief, instead of using just 1 frame page, we made 2 frames pages (page 0 opened page 1, both were frame pages and each was in a different domain).

Page www.domain1.es/INDEX0.HTML
<HTML>
<HEAD>
</HEAD>
<FRAMESET rows="*,0" scrolling="no" border="0" frameborder="0" framespacing="0">
      <FRAME name="FR_Main" src="www.domain2.es/index1.html" scrolling="auto" border="0" marginheight="0" marginwidth="0" noresize>
      <FRAME name="FR_Nada" src="blank.html" scrolling="auto" border="0" marginheight="0" marginwidth="0" noresize>
</FRAMESET>
</HTML>

Page www.domain2.es/INDEX1.HTML
<HTML>
<HEAD>
</HEAD>
<FRAMESET rows="*,0" scrolling="no" border="0" frameborder="0" framespacing="0">
      <FRAME name="FR_Main" src="index2.html" scrolling="auto" border="0" marginheight="0" marginwidth="0" noresize>
      <FRAME name="FR_Nada" src="blank.html" scrolling="auto" border="0" marginheight="0" marginwidth="0" noresize>
</FRAMESET>
</HTML>

Page www.domain2.es/INDEX2.HTML
Is the page loading the flash, we didn´t change nothing here.

Hope this helps you, I was so frustrated with this problem (even more when I read your problem and I thought I´ll find the solution here :)
0
 

Expert Comment

by:epowder
ID: 10257262
troglo

how in heaven did you find that ? I have been looking for sooo long for that.
Ending up with new pages opening after the frameset, but that changed the domain name in the address bar.

I have been here many times, finding this post in Google.

You are my expert

Thanks soo much

0
 
LVL 1

Expert Comment

by:troglo
ID: 10257507
Don´t ask me...things you try before you get mad :)

Nice to know it works to other people too; I didn´t know if it was a solution or just luck

I supposed the problem was with the two domains and the frameset combination, because in any other circunstances it worked; so I tried things to deceive Flash about the two different domains (after failing to deceive Flash about the frames).

Thanks for tell me it worked for you.

Your expert :)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now