简体   繁体   中英

Newbie -Mobile site Redirect back to Main Site Issue

I am using the delight theme in WP on my site and have a mobile website version of the main site, within a mobile folder.

I have sort of been abandoned by the mobile site provider who gave me the js for the header.php file which works fine and the mobile site loads ok on a mobile device. However, the links on the mobile pages dont take the visitor back to the main site as the mobile script reloads so they are stuck on the mobile site.

I have had to disable the js in the header until I can find a solution so I now have no mobile site until I can sort it.

Loading the mobile site with javascript in header.php works fine.

I have seen some very useful posts on here about very similar issues but writing php and session / cookies is beyond me, although I can follow clear instructions.I have run out of ideas as the stuff I am reading up on is so diverse and beyond my skills.

Can anyone provide me with the solution, help me out, bit of php, cookie or ??? I r

Really be grateful as I have disabled the js until I can resolve this - meaning no mobile version :(

thanks

Steve

If you require any more info let me know, thanks again..

Oh, I did copy the main site into a new sub folder called desktop without the js and pointed the mobile page link to it, which actually took me back to the main site / page not found, but got there. However, soon as I pressed any Nav on main site, the mobile version reloaded, damn :)

Header.php redirect script :

if (screen.width <= 800) {
window.location = "http://www.icesugarmedia.com/mobile/";;
}

</script>

code for link back to main site on each page (as a small image):

    <div style="margin:5px 0px 25px 0px;"><a href="http://icesugarmedia.com/"><img src="images/full_website_buton.png" /></a></div>
  • The mis-spelling on the button name matched the image file name

This link talks about what you're looking for.

http://www.malphursinteractive.com/view-full-site-mobile-redirect-script/

There's some pretty good solutions in that page. It's the #1 google result for the query of "script display full site mobile redirect". There seemed to be many other good solutions in the top 10 results.

What you're looking for is a solution to a problem that I think a lot of us should find, because many smartphone users want to view the full site now.

A simple solution to the problem can be to copy all the files in your directories. Create a new directory named for example "site.com/full-site/". Paste all the copied files into that directory. Remove the mobile redirect from the header.php file. Make the "view full site link" take them to full-site/index.php rather than the root directory. Now they won't encounter the line of code that forces them to the home page, unless your links are coded in " http://site.com/link.php " as opposed to "link.php". Either way, whichever method you choose, you have to prevent the user from loading the redirect script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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