Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6225765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:54:10+00:00 2026-05-24T08:54:10+00:00

I was using pyquery to construct a webpage: > page = PyQuery(‘<html><head><script type=text/javascript src=jquery-1.4.min.js></script><script

  • 0

I was using pyquery to construct a webpage:

> page = PyQuery('<html><head><script type="text/javascript" src="jquery-1.4.min.js"></script><script type="text/javascript" src="tools.min.js"></script></head><body></body></html>')
> print page
Output: <html><head><script type="text/javascript" src="jquery-1.4.min.js"/><script type="text/javascript" src="tools.min.js"/></head><body/></html>

The script (and body) tags aren’t supposed end like that though. Firefox ignores the rest of the header.

I tried breaking the above up into single elements (ie adding one script tag at a time), but to no avail:

> page = PyQuery('<html><head></head></html>')
> page.find('head').append('<script type="text/javascript" src="jquery-1.4.min.js"/></script>')
> page.find('head').append('<script type="text/javascript" src="tools.min.js"></script>')
Output: <html><head><script type="text/javascript" src="jquery-1.4.min.js"/><script type="text/javascript" src="tools.min.js"/></head><body/></html>

The same thing happens with <iframe/> tags (forced to use these due to youtube), they don’t get closed by firefox and all proceeding code is ignored.

How can I force pyquery to close these using a separate close tag, as I believe, is according to html standards.

Oh and if anyone’s wondering, I’m not doing it all in beautifulsoup because (1) I get beautifulsoup errors and (2) it’s a deprecated package, the author stopped supporting it about a year or two ago.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:54:12+00:00Added an answer on May 24, 2026 at 8:54 am

    Try:

    page = PyQuery('<html><head><script type="text/javascript" src="jquery-1.4.min.js">\n</script><script type="text/javascript" src="tools.min.js">\n</script></head><body></body></html>')
    

    It also works with iframe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using pQuery (a Perl port of jQuery) to select elements and retrieve text
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using jQuery, what's the best way to automatically initialize a plugin on all current
Using the Cocoa Framework, how can I add bullets and numbering to text?
Using PHP, I'm trying to give each specific text its own variable. I believe
Using jQuery's UI Tabs. This is my code. <div id=tabs> <ul> <li><a href=#tabs-1>Find a
Using Javascript, is there a standard way to get the absolute path of an
Using Facebox with .NET (Web Forms) is painful--this primarily HTML site was designed by
Using jQuery UI Resizable I'm trying to prevent resizing based on various rules. The
Using the Sanitize gem, I'm cleaning some HTML. In the href attribute of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.