How to run .swf (flash) file in Nette application?
- iwtu
- Member | 8
Hi!
I don't know how to run .swf file. Javascript inside a function of a presenter (see below) doesn't work.
<?php
echo("<script type='text/javascript'>");
echo("window.open('../../document_root/games/99/flash-game.swf','Flash Game');");
echo("</script>");
?>
If I try to redirect to a template which contains the Javascript's code
<script>
window.open('../../document_root/games/99/flash-game.swf','Flash Game');
</script>
or pure HTML
<a href="../../document_root/games/99/flash-game.swf"> Flash Game </a>
the Nette Debugger shows the No route for HTTP request error.
I would be grateful of any advice that helps to solve my problem.
- duke
- Member | 650
It happens probably because of your www/.htaccess file which makes apache handle the request through index.php. Try add “swf” into the list of excluded extensions in the rewrite rule:
RewriteRule !\.(swf|pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L]
Also are you sure your path is correct? I mean if document_root is your web document root directory, it doesn't make sense to access it like this. For web browser (and therefore also for javascript), the root directory is your web document root directory, i.e. maybe you should use something like this instead:
window.open('/games/99/flash-game.swf','Flash Game');
- iwtu
- Member | 8
Thanks for the useful reply. It has helped. I've added the rule and edited
the path to "../../games/99/flash-game.swf"
and it has started to
work. I truly don't know how is that possible because document_root is not my
web root directory. document_root is just web root directory for the the
application.
Thanks indeed!