cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

'netscape' is undefined (Web.Link)

SOLVED
hwillems
Newbie

'netscape' is undefined (Web.Link)

Since yesterday i can't run any Web.Link applications.

i get the error :  'Netscape' is undefined.

I am sure we didnt update creo , and I am not aware of any browser update.

does somebody have an idea what this can cause? I am using the code from the book "engineers guide to pro/e web.link" and this worked perfectely in the past.

I does anybody know of a update or an other change  that can cause this?

Kind regards,

1 ACCEPTED SOLUTION

Accepted Solutions

Re: 'netscape' is undefined (Web.Link)

I still believe your issue is due to changes that Microsoft made starting with IE11.  Your pfcIsWindows() function is searching for the string "Microsoft". Beginning with IE11 the property reports as "Netscape". See the link below for details.

Compatibility changes in IE11 (Windows)

I would suggest you rewrite your function as shown below. (I copied this code from the pfcUtils.js file that ships with Creo Parametric 3.0.

function pfcIsWindows ()

{

  if (navigator.userAgent.toString().toLowerCase().indexOf("trident") != -1)

    return true;

  else

    return false;

}

This should correctly identify your browser as IE.

Mike

View solution in original post

6 REPLIES 6

Re: 'netscape' is undefined (Web.Link)

Hello Hans,

I suspect that maybe you have upgraded your IE browser to IE11. Microsoft made some internal changes (either at version 10 or 11) that can cause some Web.link troubles if you are leveraging the PTC supplied "pfcUtils.js" jscript code. PTC rewrote the code in that file to correct this issue (I believe starting with Creo Parametric 2.0). You might try moving the file from your install to where ever your custom application is stored.

The file is located here: \Common Files\weblink\weblinkexamples\jscript

Mike

Re: 'netscape' is undefined (Web.Link)

hello Mike,

I am working with Creo 3,forget to mention.

I was indeed running IE 11 ; I tried moving the pfcUtils.js to my application folder and redirected my script to this file . But now I get the same error , only referring to this JS file.

I also tried removing IE11 from my windows 8.1 system , but still the same problem.

also tried the config options to limit to IE9 and tried to change the browser type to chromium or IE , but no change.

I really hope I can solve this , otherwise this would be a big problem at work.

Re: 'netscape' is undefined (Web.Link)

Could you post a screenshot of the error message?

Re: 'netscape' is undefined (Web.Link)

This is the error I get:

I think the problem is that the system thinks I am not on a windows machine/browser. how can I change this?

I thought the only way to change this was with the config option to choose between IE or chromium.

This is the code that is giving the error:

<SCRIPT>

//Initialization Commands

var mGlob = pfcCreate("MpfcCOMGlobal"); //Creates Global Handle to Creo

var oSession = mGlob.GetProESession(); //Initializes Session Handle

//Main Program Code

...

//Program Functions

//Utility Functions

//Checks to see if browser is Microsoft based or not

function pfcIsWindows() {

    if (navigator.appName.indexOf("Microsoft") != -1)

        return true;

    else

        return false;

}

//Function creates Pro/Web.Link objects for UNIX and Windows

function pfcCreate (className)

{

if (!pfcIsWindows())

   

    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

if (pfcIsWindows())

return new ActiveXObject ("pfc."+className);

else

{

ret = Components.classes ["@ptc.com/pfc/" +

className + ";1"].createInstance();

return ret;

}

}

</SCRIPT>

Re: 'netscape' is undefined (Web.Link)

I still believe your issue is due to changes that Microsoft made starting with IE11.  Your pfcIsWindows() function is searching for the string "Microsoft". Beginning with IE11 the property reports as "Netscape". See the link below for details.

Compatibility changes in IE11 (Windows)

I would suggest you rewrite your function as shown below. (I copied this code from the pfcUtils.js file that ships with Creo Parametric 3.0.

function pfcIsWindows ()

{

  if (navigator.userAgent.toString().toLowerCase().indexOf("trident") != -1)

    return true;

  else

    return false;

}

This should correctly identify your browser as IE.

Mike

View solution in original post

Re: 'netscape' is undefined (Web.Link)

Mike, you are my hero.

thank you very much for your support.

This teaches me to always use the PfcUtils.JS provided by ptc for my following programs.

Thanks again!

Announcements