Copy link to clipboard
Copied
Hello,
I have created a project as both SWF and HTML5 to run on various Windows based desktop computers.
In the project I would like to identify if the project is running as SWF or HTML.
I have looked at the system variables and can see that there is cpInfoIsStandalone to indicate if the project is SWF or EXE.
But, I cannot see how I can identify if the project is SWF or HTML 5.
Any thoughts would be greatly appreciated.
Thank you
Peter
Cardiff (Raining and cold)
Wales
UK
if ( typeof window.Captivate === 'object' )
{
alert( 'isSwf' );//setSomeVar
}
else
{
alert( 'isHTML' );//setSomeVar
}
Copy link to clipboard
Copied
I'm answering my own question, but would still appreciate any better way to do this.
I noticed that the SWF is called from a file ending in xxxxx.htm and the HTML5 is called by the index.html file.
So I used some javascript (shown below) to look for the current file name in use by the browser and put it in to myURL variable.
I can then use the myURL variable to identify whether the project is SWF or HTML5.
if ( window.cpAPIInterface )
{
// GET THE URL AND STRIP OUT FILENAME INTO myURL VARIABLE //
window.cpAPIInterface.setVariableValue('myURL', document.location.href.substring(document.location.href.lastIndexOf('/')+1))
}
I tested this and it appears to work.
Peter
Cardiff (Still raining, cold and now its dark)
Wales
UK
Copy link to clipboard
Copied
if ( typeof window.Captivate === 'object' )
{
alert( 'isSwf' );//setSomeVar
}
else
{
alert( 'isHTML' );//setSomeVar
}
Copy link to clipboard
Copied
TLC,
Thank you.
Your answer is much more elegant than mine.
Peter