/    Sign up×
Community /Pin to ProfileBookmark

mobile site redirect with full site link

I’m using the javascript version from [URL=”http://detectmobilebrowsers.com/”]http://detectmobilebrowsers.com/[/URL] to redirect to a mobile site. The only thing is that I have a link to go to the full site in the off chance that users want/need to go there.

However, when you click on the link to view the full site from the mobile, it picks back up on the redirection and kicks it back to the mobile version and not to the full site.

I was doing some searching and was wondering if it could be possible to hack it so that it uses

[CODE]window.location.href.indexOf[/CODE]

or somthing of that nature like this:

[CODE]if(window.location.href.indexOf(“mobile/index.html”) > -1)
{window.location = “http://thefullsiteURL.com”}
else { function (a, b) {
if (//mobile direction stuff from detectmobilebrowsers.com
})(navigator.userAgent || navigator.vendor || window.opera,
‘http://thefullsiteURL.com/mobile/index.html’)};[/CODE]

Keep in mid that this is something that I pieced together and my JS skills are fairly new, so if any one has a more elegant solution I am all for it.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @ultraloveninja spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...