Link to home
Start Free TrialLog in
Avatar of R7AF
R7AFFlag for Netherlands

asked on

Flash: link to external site doesn't work when swf is hosted elsewhere

I have a problem with creating a link in a flash movie. The situation is as follows:

1) I have a flash banner with a link in it. In fact, the whole banner is a link (in the source file it's a transparent rectangle).
2) I publish the file, upload it to a webserver, all files in the same folder. I open the page, the banner shows, the link works.
3) I move the banner to another domain, edit the html to link to the proper location, reload the page, I still see the banner.
4) I click the banner, but nothing happens. The link doesn't work anymore.

Is this normal behavior? Do I need to load the banner from the same domain to prevent abuse or something? I've uploaded the files plus the source file so you can test for yourself.
flashlink.zip
Avatar of scrathcyboy
scrathcyboy
Flag of United States of America image

You should be able to load the banner and the flash from a different website, as long as you give a COMPLETE URL in the path --

http://www.othersite.com/flash/movie.swf

Check to see if the path is full like this.
Avatar of R7AF

ASKER

You misunderstand. The flash movie loads. I can see it. The only problem is that the link in the movie doesn't work, if (and only if) the movie is loaded from another domain.

The page: www.abc.com/test.html
Banner A: www.abc.com/banner-a.swf
Banner B: banners.def.com/banner-b.swf

Banner A has a working link. The link on banner B (e.g. to wikipedia.org) does not work. What I want to know is why it doesn't work? Am I doing something wrong?
I got that the first time.  Neither links are FULL links.  Browsers have a better time with the WWW prefix, because they are used to that.  But the -- banners.def.com -- is not a normal link that can be decided by the browser to just put an http:// in front of it.

So as I said, SPECIFY THE FULL PATH, starting with http://  -- then whatever -- and they should work.
R7AF, sounds like a cross domain issue.
have a read here

http://www.flashperfection.com/tutorials/Flash-Cross-Domain-Access-85118.html
Avatar of R7AF

ASKER

@scrathcyboy
I wasn't clear, but I use a full link, so including http://. Sorry for the confusion.

@blue-genie
I'm afraid it is something like this. But I'm not reading data from another domain, I'm just linking to it. I can understand that this can be a problem because a malicious banner could redirect you to a different site, e.g. an almost exact copy with a very similar domain name, and that is a security issue because it will not be obvious all the time. I suppose that the crossdomain policy file should be hosted on the other domain, and that's a problem.
flash files can link to external links and they do all the time.  If flash couldn't do this, it would be rather useless, wouldn't it.
SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of R7AF

ASKER

@scrathcyboy
I think you misunderstand the situation. It's probably a security issue.

@blue-genie
Yes. The banner is hosted on another domain, not even a subdomain. See the mockup code below. The banner is hosted on banners.def.com, the page is on www.abc.com. I have tested this on different machines. When I put the banner on www.abc.com, the link works, when the banner is hosted on banners.def.com, it doesn't work.
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
	codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" 
	width="245" height="250" id="banner-paris-holiday" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="movie" value="http://banners.def.com/media/banner-paris-holiday.swf" />
	<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />
	<embed src="http://banners.def.com/media/banner-paris-holiday.swf" quality="high" bgcolor="#ffffff" 
		width="245" height="250" name="banner-paris-holiday" align="middle" 
		allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" 
		pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of R7AF

ASKER

I found the solution myself, and award blue-genie for the suggestions made.