The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

JS mobile

3 posters

Go down

Solved JS mobile

Post by testyforum December 30th 2017, 11:16 am

Forum version : #phpB3
Concerned browser(s) : mobile devices
Who the problem concerns : All members
Forum link : http://testyforum.forumpolish.com/forum

Helo. I have the problem/question. How can I use the JS script on mobile devices ? I would like that people using mobile devices sees this script:

Code:
$(function(){
       
        $('.post .postbody').each(function(){ /*SPACE CAISNO */
       
          var str = $(this).html();
          var newStr = str.replace(/forum/gi, "<a href='http://help.forumotion.com/'>forum</a>");
          $(this).html(newStr);
  });
        });


The script works when I use desktop browser, but when I use mobile devices is not active. Is that possible ? Sorry for my english Wink


Last edited by testyforum on January 2nd 2018, 10:11 pm; edited 1 time in total
testyforum
testyforum
Forumember

Posts : 25
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by testyforum January 1st 2018, 5:51 pm

Any ideas ? Bump.
testyforum
testyforum
Forumember

Posts : 25
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by SLGray January 1st 2018, 8:49 pm

What does this JS do?


JS mobile Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51195
Reputation : 3508
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: JS mobile

Post by SSYT January 1st 2018, 11:32 pm

Hello,
Try my code, i don't know work...
Code:
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
$(function(){
     
        $('.post .postbody').each(function(){ /*SPACE CAISNO */
     
          var str = $(this).html();
          var newStr = str.replace(/forum/gi, "<a href='http://help.forumotion.com/'>forum</a>");
          $(this).html(newStr);
  });
        });
}
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

Solved Re: JS mobile

Post by testyforum January 2nd 2018, 10:37 am

@SLGray if you write "forum" you receive
Code:
<a href='http://help.forumotion.com/'>forum</a>
so this code changes words into a link.
@Apollo 2.0 not working :/
testyforum
testyforum
Forumember

Posts : 25
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by SSYT January 2nd 2018, 9:33 pm

Hy, try this code, for me work.
Code:
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
   $(function(){
        $('.post-section .post-content').each(function(){ /*SPACE CAISNO */
          var str = $(this).html();
          var newStr = str.replace(/forum/gi, "<a href='http://help.forumotion.com/'>forum</a>");
          $(this).html(newStr);
      });
    });
}
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

Solved Re: JS mobile

Post by testyforum January 2nd 2018, 10:10 pm

YES ! Thanks @Apollo 2.0 !
Problem solved !
testyforum
testyforum
Forumember

Posts : 25
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by SLGray January 2nd 2018, 11:34 pm

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


JS mobile Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51195
Reputation : 3508
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum