简体   繁体   English

提交时移动视图的页面重定向

[英]Page Redirect for Mobile View on Submit

Ok, so I am pretty sure there has to be a simple solution to my issue, I'm just not advanced enough to figure it out.好的,所以我很确定我的问题必须有一个简单的解决方案,我只是不够先进,无法弄清楚。

Right now, I have a login/register modal that pops up when someone selects the Login/Register link.现在,当有人选择登录/注册链接时,我会弹出一个登录/注册模式。 It works as intended, no issues there.它按预期工作,没有问题。

<li class='nav__item'><a data-modal='modal-all' class='md-trigger nav__link nav__link--btn btn--show-modal' href='#'><i class='fa fa-fw fa-sign-in'></i> Log In/Register</a></li>

But, what I would like to do is redirect to a separate login or register page when on a mobile device, or smaller screen.但是,我想做的是在移动设备或更小的屏幕上重定向到单独的登录或注册页面。 My modal is both a login and register one, which users can switch between depending on what they need.我的模式既是登录模式又是注册模式,用户可以根据需要在它们之间切换。 I don't like the way it is working when shrank down to a tiny screen, it makes it too hard to see, which is why I would rather just redirect to a simpler login page for mobile clients.我不喜欢缩小到一个小屏幕时的工作方式,它很难看到,这就是为什么我宁愿只重定向到一个更简单的移动客户端登录页面。

I have been looking at the following site, https://developers.google.com/search/mobile-sites/mobile-seo/separate-urls , but not sure how this can help me, as I don't really want to redirect a whole site to a mobile version, just to one page, based on a submit button for logins.我一直在查看以下站点https://developers.google.com/search/mobile-sites/mobile-seo/separate-urls ,但不确定这对我有什么帮助,因为我真的不想根据登录的提交按钮,将整个站点重定向到移动版本,仅重定向到一个页面。

Is there a simple solution, whether with css, javascript, etc?有没有简单的解决方案,是否使用 css、javascript 等? Just for clarification, I am using javascript, css, and ejs as a templating engine.为了澄清起见,我使用 javascript、css 和 ejs 作为模板引擎。

I think you should improve your CSS in this case, but here's one way to redirect pages在这种情况下,我认为您应该改进您的 CSS,但这是重定向页面的一种方法

window.onload = function() {
 window.location.href = "url-here";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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