Saturday, November 17, 2012

php – jQuery / Javascript – Dynamically insert text into URL

I have written some PHP that detects whether a user is visiting my blog posts using a mobile device or a computer.


Basically, I need a script that edits the URL dynamically if a user is visiting my blog post with a mobile.


For example, my blog post URLs are like this:



http://www.example.com/blog/blog-post-1/

http://www.example.com/blog/welcome-to-my-blog/

http://www.example.com/blog/another-blog-post/



Users should be dynamically redirected to:



http://www.example.com/m/blog/blog-post-1/

http://www.example.com/m/blog/welcome-to-my-blog/

http://www.example.com/m/blog/another-blog-post/



I also have the device detection working in PHP, so I just need the script to insert inside the PHP condition.


Any ideas?






Rating: 2 out of 5 based on 4 ratings



The post php – jQuery / Javascript – Dynamically insert text into URL appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/php-jquery-javascript-dynamically-insert-text-into-url.html

No comments:

Post a Comment