开发者

Read address bar url from a flash site

开发者 https://www.devze.com 2023-02-22 01:53 出处:网络
my dear friends.. I have a flash site, where when a user clicks on a link the page does not reload but the content changes with flash(like any normal flash site). So for example if user click on prod

my dear friends..

I have a flash site, where when a user clicks on a link the page does not reload but the content changes with flash(like any normal flash site). So for example if user click on products page, the product page content is displayed, and the url in the address bar also changes from "domainname/index.aspx" to "domainname/index.aspx#/products"

I need to get this url from the address bar, and if i use "window.location.href" it returns "domainname/index.aspx". Does anyone know whether it is possible to read the url from the address bar which is changed by the flash.

Thanks in advance开发者_如何转开发 !!


Under ActionScript 3 (not sure about other versions), it is possible to invoke JavaScript functions in the client. You could use an ExternalInterface call to call a function that returns the URL from JavaScript (which should just be window.location).


The last part of the URL (after the # character) is know as the hash and you can read it with location.hash ;)


I would give jQuery history plugin a try. It detects when the URL changes with a hash etc.

http://tkyk.github.com/jquery-history-plugin/

And you could simply send the Flash object the url when the jQuery history plugin detects a change :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号