Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript works in PC browsers but not mobile browsers. Looking for a solution.

Status
Not open for further replies.

vr100

Technical User
Jun 18, 2010
9
US
The following page, , works in Firefox, Chrome, Safari and Internet Explorer but does not work on Iphones and Android web browsers.

There is a javascript that slowly displays "Victor Rossi" before going to the next page, , after a 7 second delay. Users can skip the "Victor Rossi" letter by letter reveal javascript by clicking on the "Skip intro" in the upper right corner. However for those visiting my website for the first time, the 7 seconds until it goes to the next page may lead them to think my website isn't working.

what can be added to the initial page just in case the web browsers are not "javascript capable" ? Here is the html page below:

<html>
<head><title>Victor Rossi</title>
<meta name="description" content="Victor Rossi has evolved from its custom couture design roots into one of the world's most reliable design houses, private label manufacturers and global sourcing agents.
Our combination of innovation, stellar craftsmanship, exceptional customer and client care are our hallmarks.">
<meta name="keywords" content="after five, after six, beauty pageant, boutique, catalog, catwalk, chic, club dresses, collection, ****tail dresses, couture, debutante, designer, dresses, dress, elegant, evening wear, exclusive, fashion, fashion designer, holiday dresses, homecoming, look of the year, Miss Teen USA, Miss USA, Miss America, Miss World, Miss Universe, pageant, pageants, party dresses, prom, special occasion, haute couture, Bob Mackie, Carmen Marc Valvo, Randolph Duke, Mark Badgley, James Mishka, Badgley Mishka, Vera Wang, Alexander McQueen, John Galliano, Stephen Yearick, Sherri Hill, Jovani, Claire's Collection, Juan Carlos Pinera, Tony Bowls, DKNY, Zac Posen, Proenza Schouler, Saks, Saks Fifth Avenue, jones, jones apparel, jonesapparel, jones apparel group, jones new york, apparel, clothing, clothes, women's, men's, kids, juniors, department, store, mall, fashion, handbags, jewelry, accessories, jeans, sweaters, tops, knits, sportswear, better apparel, bridge, designer,denim, moderates, luxury">
<meta http-equiv="refresh" content="7; Url=home.htm">
</head>
<body onLoad="self.focus()">
<p align=right><a href="home.htm">skip intro</a>
<center>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" WIDTH="1024" HEIGHT="768" id="vr.swf" ALIGN="">
<PARAM NAME=movie VALUE="vr.swf"> <PARAM NAME=quality VALUE=high> <EMBED src="vr.swf" quality=high bgcolor=#ffffff WIDTH="1024" HEIGHT="768" NAME="vr.swf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE=" </OBJECT> </center>
</body>
</html>
 
Hey Prattaratt ! I tried adding a "noscript", see below right after the <head> line on an alternate page, because I wanted the "redirect if no javascript is detected script" to work before making the index2.htm page the official index.htm page. I added <noscript>
<meta http-equiv="refresh" content="0; Url=http://www.victorrossi.com/home.htm" />
</noscript>

See below .....

<html>
<head><title>Victor Rossi</title>
<noscript>
<meta http-equiv="refresh" content="0; Url=http://www.victorrossi.com/home.htm" />
</noscript>
<meta name="description" content="Victor Rossi has evolved from its custom couture design roots into one of the world's most reliable design houses, private label manufacturers and global sourcing agents.
Our combination of innovation, stellar craftsmanship, exceptional customer and client care are our hallmarks.">
<meta name="keywords" content="after five, after six, beauty pageant, boutique, catalog, catwalk, chic, club dresses, collection, cocktail dresses, couture, debutante, designer, dresses, dress, elegant, evening wear, exclusive, fashion, fashion designer, holiday dresses, homecoming, look of the year, Miss Teen USA, Miss USA, Miss America, Miss World, Miss Universe, pageant, pageants, party dresses, prom, special occasion, haute couture, Bob Mackie, Carmen Marc Valvo, Randolph Duke, Mark Badgley, James Mishka, Badgley Mishka, Vera Wang, Alexander McQueen, John Galliano, Stephen Yearick, Sherri Hill, Jovani, Claire's Collection, Juan Carlos Pinera, Tony Bowls, DKNY, Zac Posen, Proenza Schouler, Saks, Saks Fifth Avenue, jones, jones apparel, jonesapparel, jones apparel group, jones new york, apparel, clothing, clothes, women's, men's, kids, juniors, department, store, mall, fashion, handbags, jewelry, accessories, jeans, sweaters, tops, knits, sportswear, better apparel, bridge, designer,denim, moderates, luxury">
<meta http-equiv="refresh" content="7; Url=home.htm">
</head>
<body onLoad="self.focus()">
<p align=right><a href="home.htm">skip intro</a>
<center>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" WIDTH="1024" HEIGHT="768" id="vr.swf" ALIGN="">
<PARAM NAME=movie VALUE="vr.swf"> <PARAM NAME=quality VALUE=high> <EMBED src="vr.swf" quality=high bgcolor=#ffffff WIDTH="1024" HEIGHT="768" NAME="vr.swf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE=" </OBJECT> </center>

</body>
</html>
 
Aha ! I was told that I am using FLASH which is not recognized by Android and iPhones. Noscript will not have any effect on the "Victor Rossi" flash animation :(
 
FOUND THE SOLUTION !!! I hope this helps others !!! I have posted the top portion only where the script is required. Please note that where I have used " for IF the user has flash OR " IF the browser does not have flash, PLEASE USE the full website of your own instead of my html pages. See below :

<html>
<head><title>Victor Rossi</title>
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 7;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words)))
continue;
var MM_PluginVersion = words;
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
window.location.replace("} else{
window.location.replace("}
//-->

</SCRIPT>
 
Code:
if ( MM_FlashCanPlay ) {
window.location.replace("[URL unfurl="true"]http://www.victorrossi.com/index.htm");[/URL]
} else{
window.location.replace("[URL unfurl="true"]http://www.victorrossi.com/home.htm");[/URL]
}
that's going to create an infinite loop if the code is present on either index.htm or home.htm. you should condition the method by checking for what page the user is on before redirecting. something like this

Code:
if ( MM_FlashCanPlay ) {
 if(window.location.href != "[URL unfurl="true"]http://www.victorrossi.com/index.htm"){[/URL]
   window.location.replace("[URL unfurl="true"]http://www.victorrossi.com/index.htm");[/URL]
 ]
} else{
 if(window.location.href != "[URL unfurl="true"]http://www.victorrossi.com/home.htm"){[/URL]
   window.location.replace("[URL unfurl="true"]http://www.victorrossi.com/home.htm");[/URL]
 ]
}
 
Thanks jpadie ! I was so relieved that the change, which I thought was correct, worked on cell phone browsers that I did not check that as you said, it was stuck in an infinite loop in firefox / chrome / safari / IE. I am expecting a lot of traffic this week because we got some press and since people look at websites on their cell phone browsers as much as their PC browsers, I was scrambling to make the website was working on both PC and cell phone browers.

To make it easy, I created a index2.htm page without the script and did the following on the index.htm page:

if ( MM_FlashCanPlay ) {
window.location.replace("} else{
window.location.replace("}

And it finally worked ! I greatly appreciate all the people who come on to help novices like me. I can design & sketch up a storm but am really terrible at creating correct & working scripts. So I thank all of you for helping me figure it out :) Have a great week !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top