开发者

1 back button to 3 different language links! (smart back button)?

Hello i'm afraid i try to fix the impossible...

On my site i got 3 different languages all linked to a english page. The point is i have to fix a back button to:

www.123.com/french-voiture
www.123.com/dutch-auto
www.123.com/english-car

I have to fix a script that generate automatically the right link

<li> <a href="www.123开发者_开发百科.com/french-car" title="Back" alt="Back">- </a></li>
<li> <a href="www.123.com/dutch-car" title="Back" alt="Back"> -</a></li>
<li> <a href="www.123.com/english-car" title="Back" alt="Back">- </a></li>

So i get a link to car! (english) but i can't fix the link's to the dutch and frensh language.

Is there a better way to do this or to fix this problem???


This can be solved using JavaScript. This snippet will go back 1 page in your browsers history - returning to the page they were coming from.

<a href="javascript:history.back();">back</a>

Alternatively, you can use JavaScript to check the referrer, and write out a link to a different page depending on the value of your referrer. This may be useful if you don't actually just want to go back 1 page, but go to a page depending on your referrer.


There are several solutions:

  1. Generate the English page three times, each time with a different link. From all other (localized) pages, link to the version which has the correct "back link".

  2. Save the language in the user's session and modify the HTML when the browser tries to download the English page.

  3. Add all three links and send a piece of JavaScript which makes the unwanted versions invisible or removes them from the DOM.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜