Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 使用QWebEngineView报错:js: Uncaught ReferenceError: getWebPath is not defined
Forum Updated to NodeBB v4.3 + New Features

使用QWebEngineView报错:js: Uncaught ReferenceError: getWebPath is not defined

Scheduled Pinned Locked Moved Unsolved Chinese
1 Posts 1 Posters 153 Views
  • 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.
  • W Offline
    W Offline
    wu123
    wrote on last edited by
    #1

    我在使用 Qt 的 QWebEngineView 加载一个自主开发的网页时,控制台出现 JavaScript 错误:Uncaught ReferenceError: getWebPath is not defined
    该错误表明 getWebPath 这个自定义 JavaScript 函数未被识别。

    但实际情况是:
    1、我已经在独立的 .js 文件中明确定义了 getWebPath 函数
    2、在对应的 .html 文件中,通过 <script src="..."></script> 在 <head> 标签内正确引入了该 JavaScript 文件
    3、 在普通浏览器中访问该页面时,函数可以正常调用,无任何报错
    4、问题仅在通过 QWebEngineView 加载时出现,且已困扰多时。

    尝试过的思路:
    1、检查了文件路径和引入语句,确认无误
    2、在普通浏览器中验证,功能正常
    3、怀疑是 QWebEngineView 的加载时序问题,但尚未找到有效解决方案

    恳请各位前辈指点迷津,非常感谢!

    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