script to automatically redirect to...

User 2742429 Photo


Guest
1 post

Hi Eric Rohloff,

Solution provided by you is great, just wondering if cookie can be clear after tab closed instead after a day? Appreciate if you can help.

Regards
Mufaddal
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

You should be able to add this to the script. I didn't test it yet.;)
$(window).unload(function() {
$.cookie("redirect", null, { path: '/' });
});
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2757890 Photo


Guest
6 posts

Man, I'm new here. I'm hoping SOMEONE can help.

I have a basic html website, and created a mobile-only mini-site. I have successfully added code to redirect a mobile user to the new mobile site's URL.

However, and I have tried everything, I can not get a "view full site" link to actually bust out of the mobile loop and show the regular site.

I found Eric's solution, which I thought I implemented correctly. But it isn't working.

Here's what I did:

1. copied/pasted the code Eric clearly spelled out, into the desktop site and the mobile site.
2. downloaded the cookie .js file, copied it into the root directory, then tried hard-colding the URL to point to it just in case
3. changed the URL to my mobile site in one area

nothing works.

Anyone got a second to see if it's something silly I'm missing?

site in question:

www.osgusa.com

mobile site:

www.osgusa.com/mobile
User 2088758 Photo


Senior Advisor
3,111 posts

Hi John,

I would try this code instead. Replace full.html with your full website address.

<a href="http://www.osgusa.com/" id="clicker" onclick="cookie_click()">View Desktop Site</a>


Taking over the world one website at a time!

Steve Kolish
www.misterwebguy.com

YouTube Channel:
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA
User 2757890 Photo


Guest
6 posts

Hmm, tried that, still no go.

Why is this so complicated!!! Thanks for trying though.
User 2757890 Photo


Guest
6 posts

Is your script "generic" in the sense that it can be used for any regular ol' html website?

I'm wondering if it's not specific to a platform that I'm not on or something.

Do I need to do anything to the .js file you said was required? I just copied the single .js file and put it in my root folder.

Just thinking I'm missing something little.
User 2088758 Photo


Senior Advisor
3,111 posts

First of all its not my script. I do not work for Coffeecup I am just a volunteer that likes to help out in the forums when I can.

Hmmm as for your issue... I'm not sure what to suggest. We may have to wait for Eric or one of the others to chime back in.
Taking over the world one website at a time!

Steve Kolish
www.misterwebguy.com

YouTube Channel:
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

Try removing the extra </a> tag.
<a href="http://www.osgusa.com/index.html" id="clicker" onclick="cookie_click()">View Full Site</a></a>

I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2757890 Photo


Guest
6 posts

which part is wrong?
User 2088758 Photo


Senior Advisor
3,111 posts

Eric is refering to the extra </a> tag below. I have bolded it.
<a href="http://www.osgusa.com/index.html" id="clicker" onclick="cookie_click()">View Full Site</a></a>
Taking over the world one website at a time!

Steve Kolish
www.misterwebguy.com

YouTube Channel:
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.