/    Sign up×
Community /Pin to ProfileBookmark

Can this script be being fixt so it wil play my mobile website on al mobile devices? :

<script>
if((navigator.userAgent.indexOf(“PPC”)!= -1) && (navigator.userAgent.indexOf(“Mac”)==-1)){top.location.href=’mobilebest/index.html’;}
</script>

I am not that good with javascript to do it my self.?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Apr 27.2008 — There are frames right?[code=php]
top.location.href="mobilebest/index.html";
[/code]

Should do the trick.
Copy linkTweet thisAlerts:
@stroke33authorApr 27.2008 — There are frames right?[code=php]
top.location.href="mobilebest/index.html";
[/code]

Should do the trick.[/QUOTE]


No there are no frames,the script is in de head of my website and the mobile website is working great on my PPC ,but it is not vissible on my MDA/GSM with internet conection,if i fill the url of my website in on the MDA/GSM then the original website appears but with a scroll bar on the bottom.

Would it work if I place the line (navigator.userAgent.indexOf("MDA")!= -1) between the () of the script like this

<script>

if(((navigator.userAgent.indexOf("PPC")!= -1) && (navigator.userAgent.indexOf("Mac")==-1)&& (navigator.userAgent.indexOf("MDA")!= -1))){top.location.href='mobilebest/index.html';}

</script>

<script language="JavaScript" type="text/JavaScript">
Copy linkTweet thisAlerts:
@Declan1991Apr 27.2008 — It's utterly pointless to test the userAgent really. You are trying to target all mobiles are you? Well the problem is that you can not get that to work in all mobiles because you won't be testing in all. What exactly are you trying to do? There might be an easier solution.
Copy linkTweet thisAlerts:
@stroke33authorApr 27.2008 — I try to show my mobile website I have created to show on al mobile phones ,MDA's and PDA's,I no there is a possebillety like www.mywebsite.mobile but I want to be possible to reach al mobilephones with a special written site because of the size of the mobile screen within my normal website.
×

Success!

Help @stroke33 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.18,
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,
)...