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

  • Home
  • SEARCH
  • 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 8169359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:49:21+00:00 2026-06-06T20:49:21+00:00

I’m trying to get some attributes for HTML tags in a web page. <html>

  • 0

I’m trying to get some attributes for HTML tags in a web page.

<html>
<head>
  <title>test page</title>
</head>
<body>
  <div id="header" class="clearit" role="banner">
    <div id="headerWrapper">
      <ul id="primaryNav" role="navigation">
        <li id="musicNav" class="navItem">
          <a href="/music" class="nav-link">Music</a>
        </li>
        <li id="listenNav" class="navItem">
          <a href="/listen" class="nav-link">Radio</a>
        </li>
        <li id="eventsNav" class="navItem">
          <a href="/events" class="nav-link">Events</a>
        </li>
        <li id="chartsNav" class="navItem">
          <a href="/charts" class="nav-link">Charts</a>
        </li>
        <li id="communityNav" class="navItem">
          <a href="/community" class="nav-link">Community</a>
        </li>
        <li id="originalsNav" class="navItem">
          <a href="http://originals.last.fm" class="nav-link">Originals</a>
        </li>
      </ul>
    </div>
  </div>
</body>
</html>

For example, I need the actual height and width for #headerWrapper and compare it with #musicNav in my PHP script. Since PHP is server-side, I can’t get these attributes so I’m thinking to append Javascript code to calculate these attributes and store them in a JSON file like in this code:

<script type="text/javascript">
document.ready(function() {
  var JSONObject= {
    "tagname":"headerWrapper",
    "height":$("#headerWrapper").height(),
    "width":$("#headerWrapper").width()
  },
  {
    "tagname":"musicNav",
    "height":$("#musicNav").height(),
    "width":$("#musicNav").width()
  }
  });
});  
</script>

Then I’d like to read it in the php file that contains my algorithm to extract visual features from web pages. So I need to render the web page with appended Javascript using some browser. I’m using exec to send the new file to Firefox, like this:

exec('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "http://localhost/Autoextractor/test.html" 2> errors.txt');

And Firefox opens in taskmanager but does not dispaly, the page is not rendered, and my appended Javascript code is not executed.

safe_mode=off – disabled_functions deleted from php.ini and when executing
exec(“whoami”);
The result is my user (note: my user in Administrator group) and I did try wscript with no result.

Does anyone have any idea why it’s not working, or has another solution to get the dimensions of HTML tags?

  • 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-06-06T20:49:23+00:00Added an answer on June 6, 2026 at 8:49 pm

    Simply running a browser won’t allow you to read any data back from it, so forget about using system.

    You can use Selenium Webdriver to control a browser with PHP, run JavaScript, then return the result.

    When you write your real JavaScript, you will need to fix the syntax errors that appear in the example you included in the question.

    Keep in mind that the size of elements on screen will depend on factors such as installed fonts, chosen font size, browser, window size, etc. You can get a result for a browser running on your system, but you can’t depend on it to be a universal result.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.