: SEO & Return false on click event I have a dropdown menu and I'm a trying to make it function more logically on touch devices, it currently following the link. On desktops the dropdown menu
I have a dropdown menu and I'm a trying to make it function more logically on touch devices, it currently following the link.
On desktops the dropdown menu is displayed onmousehover and when the menu item is clicked, you are taken to a page. I've added a piece of code to this so it doesnt follow the link on touch devicesc.
function(e) {
if (isTouch) return false;
showMenu();
}
I'm a little concerned with the SEO implications of this, will it have any impact?
More posts by @Eichhorn148
2 Comments
Sorted by latest first Latest Oldest Best
Google and other search engines understand a great deal of JavaScripts these days and the code you displayed search engines will have no trouble understanding it. Most responsive frameworks if not all use a similar method to render the menus, bootstrap, zurb foundation etc on Mobile devices.
If you would like to use a non-js method then you could use a form using options and then rendering the form only on the mobile device using a media query.
Form Example
@media (max-width: 640px) {header form{display:none;}} @media (min-width: 641px) {header nav{display:none;}}
The benefits of this also would mean that anyone on a mobile device that has disabled JS for one reason or another then the page would still render and be usable, while with the current version you have it will be not-usable for people with no js on touch devices.
NO JS
I've seen many devices these days like tablets and large led screens with touch screen espiecally laptops with Windows 8 so its likely these will become more common so it might be even better to have a no-js rather than just a min-width, like so:
.no-js {header nav{display:none;}
Then of course you just need a JavaScript to remove the no-js from the html when JS is present.
Summary
If maximum compatibly is importance then go with NO-JS. if you believe that user experience and not many people will be disabling JS then go with the CSS/JS solution as thats much easier ;)
This will not hurt you. Having your site do different things depending on environmental factors (such as the type of device) is common and ok to do. You only have an issue when you intentionally serve different content to search engines than to users and that clearly is not the case here.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.