Search code examples
htmlvue.jsnuxt.jsactivex

Nuxt: How to load html4 with activeX in Nuxt App?


I want to use activeX so I will call the activeX by html

And then I will use <object> tag like this

<OBJECT ID="SAMPLE_API" CLASSID="CLSID:AnGUID" width=0 height=0></OBJECT>

And the activeX of CLSID:AnGUID has some functions.

And I need to call a function of there in javascript, like var ticket = SAMPLE_API.GetTicket("APP_ID") // this return will be string

Well so, I need to use html with activeX in Nuxt project

But I don't know where to insert it on <template></template> and its files(bulahbulah.html) on the directories. When I tried to insert the file in ~/pages, then the webpage emitted "ReferenceError File is not defined."

And it happened when I made directory like ~/login, and moved the files to the directory, too.

How can I use the html in the Nuxt project in this case?


Solution

  • I solved this problem like this.

    1. Use res.sendFile(). If you connect a url which is using res.sendFile(/path/to/bulahbulah.html), it will show the bulahbulah.html page which can use activeX(But you need to use internet explorer to run the activeX basically).
    router.get('/', async (req, res, next) => {
      res.sendFile('/path/to/bulahbulah.html')
    }
    
    1. When you need to use the values from the bulahbulah.html page in Nuxt App, then you can transport the values with query string. If the Nuxt page is /nuxtPage then, you can append a line in bularbular.html page like this
    self.location.replace("/nuxtPage?foo=bar);
    

    So, you can use the values from the normal html page. But, as it transport the values as just query string, need to watch out in using secret values.