2
我一直在试图建立重定向的范围开始从/店/店#ecwid网址!/〜/导致/店#!/〜/车JS ecwid URL重定向
我有想出这个代码:
var wrong_url = ['http://example.com/shop','http://example.com/shop#','http://example.com/shop#!','http://example.com/shop#!/','http://example.com/shop#!/~','http://example.com/shop#!/~/'];
var current_url = document.URL;
for (i=0;i<wrong_url.length;i++) {
if (current_url==wrong_url[i]) {
document.location.replace('http://example.com/shop#!/~/cart');
break;
}
}
它的工作原理没事,但有一个问题。当我在/ shop#!/〜/ cart中,然后手动将url更改为/ shop#!/〜/时,它将不会被重定向,直到我刷新页面。我相信这与ecwid购物车的ajax行为有关,但无法弄清楚如何与之对抗。
需要帮助?
这很好,谢谢! – tonydoe