开发者

Help with changing iframe ajax

开发者 https://www.devze.com 2023-01-21 00:00 出处:网络
Hello there ok i may be wrong about this and if开发者_Python百科 i am then i am sorry. But is it possible to change the screen with ajax by looking at whats after the \"#\" in the link.

Hello there ok i may be wrong about this and if开发者_Python百科 i am then i am sorry. But is it possible to change the screen with ajax by looking at whats after the "#" in the link. because when im on facebook i know that it is all an iframe yet when the screen changes so does the text after the "#". Is that what is causing the change or is that a result of the change. Because i have JavaScript on my site and when you click a function it adds a "#" to the link but never any text.

Thank you so much.


The part of the URL after the # is called the "hash tag" and you can use JavaScript to change it like this:

document.location = "#abc"

You can also set the hash tag using an anchor like this:

<a href="#abc">Click me to put #abc on the end of the url</a>

To get the hash tag you can use this:

hash_tag = window.location.hash

Facebook is not displayed inside an iFrame but all of the content is generated using JavaScript, and they set the hash tag deliberately so when you reload the page, they can look at the hash tag and give you the right content.

0

精彩评论

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