简体   繁体   中英

Read address bar url from a flash site

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 ).

URL的最后一部分(在#字符之后)称为哈希,您可以使用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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM