Solved

IE and Netscrape....

Posted on 2000-03-21
6
202 Views
Last Modified: 2013-12-24
With the two browsers vieing for the frontline in browserdom, it is a real problem setting up a webpage with facilities that front page 2000 offers and finding that netscape users arent able to view pages correctly. In fact Netscape tends to crash badly in parts of the site i'm developing ... not a good look .... and i dont feel like fielding questions from disgrunteled netscape users.

Is i possible through java scripting, or whatever to provide the following....

If it is netscape then

....

else

.....

endif

This would allow me to write code on a page per page basis rather than having to develop two duplicate websites !!

I know how to test for the browser ... what i dont know is how to use this information in any way other than to
call a different piece of html.

Any thoughts would be appreciated

Thanks,

Brendan Vowles
0
Comment
Question by:Bren
  • 4
  • 2
6 Comments
 
LVL 1

Expert Comment

by:damianosky
ID: 2639335
Your is a common problem. Netscape has some bugs of itself (it crashes also without forntpage extension page) and this is worse with extension...

Obviously yes, you can check the browser type. The code is the following:

      if (navigator.appName.indexOf("Microsoft") >= 0)
      {
            document.location.href = "IEpage.asp"
      }
      else
      {
            document.location.href = "NSpage.asp"
      }

You can control also the version of the browser through the appVersion method of the navigator object:

version = parseInt(navigator.appVersion);

With this code you can simply redirect the browser (suggested method!!!). Alternatively, you can get a different output, simply using the same If ... structure to write different HTML code using the write method, e.g.:

document.write('<H2>Text to write</H2><BR>')





0
 

Author Comment

by:Bren
ID: 2639522
Sorry but i really need more information .... could you supply me with some examples so i have an idea how to apply the codeing to the html ??

Thanks
0
 
LVL 1

Expert Comment

by:damianosky
ID: 2639699
You have to put in your page this:


<script language="javascript">
<!--
if (navigator.appName.indexOf("Microsoft") >= 0)
{
  // this code will be written only on Explorer
  document.write('<H2>Text to write specific for Explorer</H2><BR>')
  document.write('<H3>Good Work with explorer</H3><BR>')
}
else
{
  // this code will be written only on Netscape
  document.write('<H2>Text to write specific for Netscape</H2><BR>')
  document.write('<H2>Good Work with  Netscape</H2><BR>')
}
//-->
</script>

Every time you need to differentiate the code for the two browsers, use this schema: in the write() method put the code you need different for the two browsers.

You can do that more and more. Keep in mind, however, that this will be on client side, so all the page you wirte will be dowloaded, not only the specific part.

So, if you have to do muche different the two pages, is better to redirect to different small pages.


0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 1

Expert Comment

by:damianosky
ID: 2639713
<html>
<head>
<link rel="stylesheet" type="text/css" href="../library/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="it">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Border" content="none">

<title>test</title>
</head>

<body topmargin="0" leftmargin="0">

<script language="javascript">
<!--
if (navigator.appName.indexOf("Microsoft") >= 0)
{
  // this code will be written only on Explorer
  document.write('<H2>Hello Explorer User</H2><BR>')
}
else
{
  // this code will be written only on Netscape
  document.write('<H2>Hello Netscape User</H2><BR>')
}
//-->
</script>

<!-- Common part -->
<p>This is a nice day!!!</p>


<script language="javascript">
<!--
if (navigator.appName.indexOf("Microsoft") >= 0)
{
  // this code will be written only on Explorer
  document.write('<p>Hope you like Explorer</p><BR>')
)
  document.write('<H3>Good Work with explorer</H3><BR>')

}
else
{
  // this code will be written only on Netscape
  document.write('<H2>Hope you like Netscape</H2><BR>')
  document.write('<H2>Good Work with  Netscape</H2><BR>')
}
//-->
</script>

</body>
</html>

Try this code: on Explorer you'll get:

Hello Explorer User
This is a nice day!!!
Hope you like Explorer
Good Work with Explorer

On Netscape

Hello Netscape User
This is a nice day!!!
Hope you like Netscape
Good Work with Netscape


Hope this help you.
0
 
LVL 1

Accepted Solution

by:
damianosky earned 100 total points
ID: 2639733
Tha same you can do with javascript function (e.g., to avoid compatibility issues between the 2 browsers):

<html>
<head>
<link rel="stylesheet" type="text/css" href="../library/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="it">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Border" content="none">

<title>test</title>

<script language="Javascript">
<!--
function WriteMyMessage()
{
  if (navigator.appName.indexOf("Microsoft") >= 0)
  {
    // this code will be written only on Explorer
    document.write('<p>Hope you like Explorer</p><BR>')
)
    document.write('<H3>Good Work with explorer</H3><BR>')

  }
  else
  {
    // this code will be written only on Netscape
    document.write('<H2>Hope you like Netscape</H2><BR>')
    document.write('<H2>Good Work with  Netscape</H2><BR>')
  }
}

//-->
</script>

</head>

<body topmargin="0" leftmargin="0">
<script language="Javascript">
<!--
WriteMyMessage();
//-->
</script>
</body>
</html>


The output will be different according to browsers and, if in your function want to use specific implementation of the javascript (wich is a bit different between MSIE e NS), you can do that, without no more problems.

You can add more and more complexity, e.g. with browsers and javascript version (1.0, 1.1, 1.2). The limit is only your fantasy and, of course, page size.


0
 

Author Comment

by:Bren
ID: 2639796
Thank you .... your input has been most helpful
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio only works when connected to my office's network. 8 105
What is the Best Web Design Tool 1 54
bootstrap submit button 12 116
Google Maps 7 72
In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now