Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How do I specify an absolute URL for a javascript import?
Forum Updated to NodeBB v4.3 + New Features

How do I specify an absolute URL for a javascript import?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 893 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rolias
    wrote on last edited by
    #1

    The "help topic on importing JavaScript resources": http://qt-project.org/doc/qt-5/qtqml-javascript-imports.html in QML says:

    bq. JavaScript resources may be imported via either relative or absolute URLs.

    However, I couldn't find any examples of how do do this. As a simple test, under windows, using QML 5.3, I tried moving my utils1.js file to the root of my E drive and then I used

    @import "E:/utils.js" as MyUtils@
    

    But that generates a "Script e:/utils1.js unavailable" error followed by "e:/utils1.js:-1 Network error". I then tried some other forms with the file prefix but haven't found anything that will work.

    Check out my third course in the trilogy on Qt
    "Integrating Qt Quick with C++"
    http://bit.ly/qtquickcpp
    published by Pluralsight

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      you can try importing like

      import "../../../../utils1.js" if qml and js are in drive.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved