Results 1 to 4 of 4

Thread: oh! my god. SyntaxError: Parse error javascript

  1. #1
    Join Date
    Feb 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Angry oh! my god. SyntaxError: Parse error javascript

    i am used qt 4.8 .

    i when load a page javascript in qwebview error parser error give me.

    old code with parser error.
    Qt Code:
    1. setRequestHeaders: function() {
    2. var headers = {
    3. 'X-Requested-With': 'XMLHttpRequest',
    4. 'X-Prototype-Version': Prototype.Version,
    5. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    6. };
    7.  
    8. if (this.method == 'post') {
    9. headers['Content-type'] = this.options.contentType +
    10. (this.options.encoding ? '; charset=' + this.options.encoding : '');
    11.  
    12. /* Force "Connection: close" for older Mozilla browsers to work
    13.   * around a bug where XMLHttpRequest sends an incorrect
    14.   * Content-length header. See Mozilla Bugzilla #246651.
    15.   */
    16. if (this.transport.overrideMimeType &&
    17. (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
    18. headers['Connection'] = 'close';
    19. }
    To copy to clipboard, switch view to plain text mode 

    new code with not parser error.

    Qt Code:
    1. setRequestHeaders: function() {
    2. var headers = {
    3. 'X-Requested-With': 'XMLHttpRequest',
    4. 'X-Prototype-Version': Prototype.Version,
    5. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    6. };
    7.  
    8. if (this.method == 'post') {
    9. headers['Content-type'] = this.options.contentType +
    10. (this.options.encoding ? '; charset=' + this.options.encoding : '');
    11.  
    12.  
    13. if (this.transport.overrideMimeType &&
    14. (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
    15. headers['Connection'] = 'close';
    16. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by ali_esfahan; 28th November 2012 at 08:06.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: oh! my god. SyntaxError: Parse error javascript

    welcome. Do you have a Qt question?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Feb 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: oh! my god. SyntaxError: Parse error javascript

    excuse me.
    this is a bug.
    Because when I remove the comment I error does not occur again
    I can not change server code.
    How do I solve this problem.

    this comment
    Qt Code:
    1. /* Force "Connection: close" for older Mozilla browsers to work
    2.   * around a bug where XMLHttpRequest sends an incorrect
    3.   * Content-length header. See Mozilla Bugzilla #246651.
    4.   */
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: oh! my god. SyntaxError: Parse error javascript

    why can't you change server code?

    report error/bug to Digia, the new owners of Qt.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. QtXml parse error at line 1 column line 1
    By vinod sharma in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 8th September 2012, 05:02
  2. Replies: 1
    Last Post: 11th May 2012, 18:08
  3. Replies: 9
    Last Post: 29th November 2010, 12:12
  4. QtWebkit and JavaScript error messages
    By Diph in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2009, 11:10
  5. qmake parse Error
    By mka in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2007, 08:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.