简体   繁体   中英

Javascript history go — if not, go to index.html

To go back to the appropriate tumblr page, we're using:

<a href="javascript:history.go(-1)"> Back </a>

However, we're getting a lot of traffic directly from the twitter app, and this stops the function working. Is there a way so that if the history.go doesn't work (or takes you outside the site), it will just take you to index.html?

This is one of the pages the history button is on: http://lexican.info/post/49265445109/sesquipedalophobia

Thanks for any help at all.

Try to check how many page in the history list with history.length :

http://www.w3schools.com/jsref/prop_his_length.asp

可悲的是,我认为这是不可能的,因为帖子与帖子显示在索引的哪一之间没有关系。

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