0 votes
in Education by (1.7m points)
Is it possible to remove ( not hide using display:none ) some part of HTML from source for mobile using Javascript or any server side technique?

For example suppose below is the code inside <body> of one of the page of website

For example this is page for desktop Browsers.

<header class="hd1">

        <hgroup>

        <h1>A Responsive page</h1>

        </header>

    <div class="main">

        <section class="hs1">

            <header>

            <h1>This is a Page Sub Title</h1>

            </header>

            <p>Some content...</p>

            <h2>Demonstrating EM and STRONG</h2>

            <p>This text will have more importance></p>

        </section><!-- .hs1 -->

        </div><!-- .main -->

    <aside class="sidebar">

    <p>Sidebar content</p>

    </aside>

    <footer class="f1">

    <p>copyright &copy; year</p>

    </footer>

And using same page for Mobile devices I only want to remove <aside>...</aside> from the source.

I can't use different page because is CMS based. By updating content once I want to show on all devices. But in mobile version of Website I just want to remove (hide) some things from source. because If i will just use display:none mobile will load same amount of data of desktop version which is not for performance on mobile. Can we remove some specific part of source for mobile using Javascript or server side technique?

Edit after some responses

As many user commented that JavaScript cannot be used to reduce the payload to mobile users. So what could be the server side solution to deliver the same page but remove some part of it from source before delivering it?

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
You can detect mobile browser on the server and just not render this tag.

There's no point in removing this using javascript, if you do this to save bandwidth.
...