0% found this document useful (0 votes)
12 views40 pages

Report On Web Broswer

The document discusses a report on web browsers submitted for a university course. It describes the purpose of web browsers, which is to retrieve and display web pages and other online content. It then discusses the scope of the project, including how browsers work by requesting pages via URLs and displaying the content, and defines some key features of browsers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views40 pages

Report On Web Broswer

The document discusses a report on web browsers submitted for a university course. It describes the purpose of web browsers, which is to retrieve and display web pages and other online content. It then discusses the scope of the project, including how browsers work by requesting pages via URLs and displaying the content, and defines some key features of browsers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

1

A
Minor Project-1 Report
On

“ WEB BROWSER”

Submitted in partial fulfillment of


The requirements for the 5th Semester Sessional Examination of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE & ENGINEERING

By
NAME- Ankit Hota (19CSE211)
Dinesh Kundo(19CSE166)
Abhinash Raj Bhuyan(19CSE135)

Registration no:-1901060206,1901060162,1901060133

Under the able supervision of


Dr.Raghvendra Agrawal

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


2

GIET UNIVERSITY,GUNUPUR
2021-22

GIET UNIVERSITY
Gunupur-765022, At – Gobriguda, Po- Kharling, Dist. - Rayagada, Odisha
Contact:- +91 7735745535, 06857-250170,172,Visit us:- www.giet.edu

Department of Computer Science & Engineering

CERTIFICATE

This is to certify that the project work entitled “WEB BROSWER” is done by

NAME-Dinesh Kundo,Ankit Hota,Abhinash Raj Bhuyan

Regd. No.-1901060162,1901060206,1901060133 in partial fulfillment of the

requirements for the 5th Semester Sessional Examination of Bachelor of

Technology in Computer Science and Engineering during the academic year

2021-22. This work is submitted to the department as a part of evaluation of 5th

Semester Project-1.

Dr.Raghvendra Agrawal` Mr. K.Siva Krishna


Superviser Teacher class teacher

Mr.Bhavani Sankar Panda


Dr.Sanjay Kumar Kuanar
Project coordinator,3rd year
HOD,CSE
3

ACKNOWLEDGEMENT

I would like to thank my supervisor Dr. Raghvendra Agrawal like to express


our profound sense of gratitude to all for having helped us in completing this
dissertation. We would like to express our deep-felt gratitude and sincere thanks
for his guide.

For Secondly I would like to thank my class teacher Mr. K.Siva Krishna for
their constant moral support, cooperation and encouragement during this period.

Thirdly I would like to thanks our Project Coordinator


Mr. Bhavani Sankar Panda for providing the necessary facilities for
the successful completion of this work.

A special gratitude to our HOD Dr. Sanjay Kumar Kuanar, for


supporting us at every time we are very thankful to them.

Thanks to friends by their support i am able to complete the project with


in time successfully.

Thank you
Ankit Hota
Dinesh Kundo
Abhinash Raj Bhuyan
4

ABSTRACT

A web browser (commonly referred to as a browser) is a software application for retrieving,


presenting and traversing information resources on the World Wide Web.

An information resource is identified by a Uniform Resource Identifier (URI/URL) and may


be a web page, image, video or other piece of content. Hyperlinks present in resources enable
users easily to navigate their browsers to related resources.

Although browsers are primarily intended to use the World Wide Web, they can also be used
to access information provided by web servers in private networks or files in file systems.

Available web browsers range in features from minimal, text-based user interfaces with bare-
bones support for HTML to rich user interfaces supporting a wide variety of file formats and
protocols. Browsers which include additional components to support e-mail, Usenet news,
and Internet Relay Chat (IRC), are sometimes referred to as “Internet suites” rather than
merely “web browsers”.
web Browser is an application software that allows us to view and explore information on the
web. User can request for any web page by just entering a URL into address bar. Web
browser can show text, audio, video, animation and more
Virtually all URLs on the Web start with either the Hypertext Transfer
Protocol (http:) or Hypertext Transfer Protocol Secure (https:). These protocols define rules
for how messages are formatted and transmitted, essentially allowing the web browser to
communicate with the World Wide Web Server.
HTTPS is utilized when the communication between the browser and the web server needs
to be encrypted for the purposes of security and privacy.
Once the browser and web server are able to communicate, the browser needs to connect to
the web server in order to retrieve the web page requested.For this, it translates the server
name to the Server IP Address via the Domain Name System (DNS). It then sends a HTTP or
5

HTTPS request to the server for a copy of the website over the internet connection. If the
request is approved by the server, the browser starts receiving the website’s files in small
chunks of data called data packets.
Web pages are retrieved by the web browser in the form of files encoded in languages such
as hypertext markup Language, cascading style sheets , and Javascript. Once a web page has
been retrieved, the browser's rendering engine displays it on the user's device. This
includes image and video formats supported by the browser. Plugins and browser
extensions can also embed different types of content into web pages

 INTRODUCTION

 PURPOSE

The first web browser was invented in 1990 by Sir Tim Berners-Lee. Berners-Lee is the
director of the World Wide Web Consortium (W3C), which oversees the Web’s continued
development, and is also the founder of the World Wide Web Foundation. His browser was
called WorldWideWeb and later renamed Nexus.

A web browser is a software application which enables a user to display and interact with text,
images, videos, music, and other information that could be on a website. Text and images on a
web page can contain hyperlinks to other web pages at the same or different website.

Web browsers allow a user to quickly and easily access information provided on many web
pages at many websites by traversing these links. Web browsers format HTML information for
display so the appearance of a web page many differ between browsers.

A web browser (commonly referred to as a browser) is application software for accessing


the World Wide Web. When a user requests a web page from a particular website, the web
browser retrieves the necessary content from a web server and then displays the page on the
user's device.

Web browsers commonly include an address bar or search bar, the ability to open multiple
web pages in different tabs, and other user interface features for navigating the web.

Although web browsers have a variety of functions, they also face a plethora of
vulnerabilities that can be a critical threat to user privacy. With that, security plays a vital
role in ensuring user safety against internet hackers.
6

Web browsers are used on a range of devices, including desktops, laptops, tablets,
and smartphones. In 2020, an estimated 4.9 billion people used a browser.
The most used browser is Google Chrome, with a 65% global market share on all devices,
followed by Safari with 18%.

 Project Scope

A web browser takes you anywhere on the internet. It retrieves information from other parts
of the web and displays it on your desktop or mobile device.

The information is transferred using the Hypertext Transfer Protocol, which defines how
text, images and video are transmitted on the web. This information needs to be shared and
displayed in a consistent format so that people using any browser, anywhere in the world can
see the information.

Sadly, not all browser makers choose to interpret the format in the same way. For users, this
means that a website can look and function differently. Creating consistency between
browsers, so that any user can enjoy the internet, regardless of the browser they choose, is
called web standards.

When the web browser fetches data from an internet connected server, it uses a piece of
software called a rendering engine to translate that data into text and images.

This data is written in Hypertext Markup Language (HTML) and web browsers read this
code to create what we see, hear and experience on the internet.

Project scope is the part of project planning that involves determining and documenting a list
of specific project goals, deliverables, tasks, costs and deadlines. The documentation of a
project's scope is called a scope statement or terms of reference. It explains the boundaries of
the project, establishes responsibilities for each team member and sets up procedures for how
completed work will be verified and approved.

During the project, this documentation helps the project team remain focused and on task.
The scope statement also provides the team with guidelines for making decisions about
change requests during the project. Note that a project's scope statement should not be
confused with its charter; a project's charter simply documents that the project exists.
7

Large projects tend to change as they progress. If a project has been effectively "scoped" at
the beginning, then approving and managing these changes will be easier. When
documenting a project's scope, stakeholders should be as specific as possible to avoid scope
creep. Scope creep is a situation in which one or more parts of a project end up requiring
more work, time or effort because of poor planning or miscommunication.

Project Features

Some of the features of the web browser include-

1. Home button – Clicking the ‘Home’ button brings the user directly back to the home
page of the browser. We can set any webpage as the home page. Usually people prefer
to have search engines like – Google.com as their home page.

2. Address bar – The address bar is where the URL of the desired website is entered.
This bar helps us to navigate to the desired website of our choice.

3. Refresh button – The refresh button is to reload the page. In some cases, the page
locally stores and saves the information. This prevents users from seeing the updated
information. Therefore, the refresh button is helpful in such cases.

4. Bookmarks – This option is to save a particular website for reference later in the
future. It is used to mark pages that might be important or prove to be useful in the
future.

5. Tabbed browsing – This feature helps to open new screens on the same browser for
multiple browsing at the same time.
 Navigation buttons. Refresh button is used to go back and forward while browsing. ...
 Refresh button. Refresh buttons is used to force web browser to reload webpage. ...
 Stop button. ...
 Home button. ...
8

 Web browser's address bar. ...


 Integrated search.
9

WHAT IS WEB BROWSER AND IT’S IMPORTANCE &

NEED?

A software application used to access information on the World Wide Web is called a Web
Browser. When a user requests some information, the web browser fetches the data from a
web server and then displays the webpage on the user’s screen.

It’s easy to overlook the importance of the browser now that it’s become ubiquitous in our
daily lives. Before the advent of web browsers, users had to install apps just to chat, watch
videos, and listen to music. Nowadays, these apps are seeing a resurgence on mobile devices
for convenience. Apps may be the preferred choice of anyone with a singular interest but on
the long run, a web browser would still be the most practical choice to view and enjoy a
multitude of diverse content, applications, and functions. So how do you know what web
browser to use? Here are the top traits that make a good web browser.

 Speed

A browser should be able to quickly load webpages, no matter how dynamic the content.
Nowadays images and videos dominate online platforms. Every day, 300 hours of video are
uploaded every minute on Youtube, while Facebook gets up to 8 billion average daily views
from 500 million users alone.

With the rapid growth of the web as an engaging and interactive platform, the browser’s
development is a must to accommodate the increased amount of data, as well as users, going
through it.

Speed and stability is particularly important for Filipinos given their Internet activities.
According to We Are Social, Filipinos highly involve themselves in heavy web activities,
with 99% of the Internet users streaming videos online monthly, while 75 million are active
on Facebook and 11 million on Instagram. Additionally, Filipinos spend a remarkable
average time of 10 hours daily on the Internet and more than 4 hours on social media.

 Simplicity
10

A browser should also be simple and easy-to-use. The user interface shouldn’t take up a lot
of screen space, which would be better used for the content that a user is trying to consume.
Google Chrome, for instance, has stripped away everything but the bare minimum in order to
let users focus on content and not on the browser itself. Chrome also has an all-purpose box
on top called the ‘omnibox,’ which can be used for typing in web addresses and search
queries.

\ It also opens up tabs very easily – each new tab shows tiles of most frequently visited
pages, to help users get to where they want to go on the Web faster. Run Visual Basic and
start a new project by going to the File menu and clicking on "New Project." Browse over
"Text" and select "Web Browser" in the form page that appears. Go to "View" in the top
menu bar, browse over "Other Windows" and click on "Toolbox."

This will display the Visual Basic toolbox.

 Security

Browsers should also be very secure, as malware is a constant threat on the Internet. This
could lead to serious data breach and leakage which major businesses such as Facebook,
Quora, and Marriott have suffered from security lapses in 2018.

In the Philippines, over 10.6 million malware infections have caused the country to rank as
ninth in the world in terms of volumes of online attacks.

Web browsers these days are designed to prioritize users’ security. Chrome, for instance,
scans your computer for malicious software on demand. While browsers themselves are a
good defense against malware, it is best to also use an anti-malware software that offers real-
time protection to boost your computer’s security.

The main purpose of an internet browser is to translate, or render, the code that websites are
designed in into the text, graphics, and other features of the web pages that we are all used to
seeing today.
11

System analysis

Web browsers are diverse, with each one having its own characteristics. This enables users to
choose their own favorites or to try various Web browsers at the same time. In this situation,
it is hard to trace the Web sites that a user has visited if the forensic investigator can analyze
only log files from a specific Web browser.

Therefore, the investigator must be able to examine all existing Web browsers in one system
and to perform integrated analysis of multiple Web browsers. For integrated analysis, the
critical information, more than all other information, is time information. Every Web
browser’s log file contains time information, and therefore it is possible to construct a
timeline array using this time information.

 Hardware Requirements:-

CPU  Processor 1 Ghz


CPU or above

RAM Available  1 GB RAM or


above

Disk space  100 MB

Internet Access  Direct Internet


Connection1

 Hardware Recommendations:
The recommended hardware configuration is listed below:
12

CPU –RAM 2 GB RAM or above Processor 2 Ghz CPU or above

Available Disk space 1GB

Internet Access Direct Internet Connection1


RAM Available 1.5GB

 Software Requirements
The minimum software requirements are listed below:

Operating System Any (no specific OS required / Only a


browser is

required
Web Broswer Microsoft Windows Internet Explorer
9.0 or higher

Current version of Chrome


Current version of Firefox
Current version of Safari
Java Virtual Machine Not Required

 Software Requirements:
Web Broswer Microsoft Windows Internet
Explorer 9.0 or higher
 1. SYSTEM DESIGN & SPECIFICATIONS
1.1-HIGH LEVEL DESIGN(HLD):

 Flow Chart
13

(Diagram 1.1)

(Diagram 1.2)

ER-Diagram
14

1.1. • LOW LEVEL DESIGN (LLD)


15

Process Specification ( Pseudo code / Algorithm )

This section does not attempt to provide full details of the messages exchanged
during the SSL handshake. In overview, the steps involved in the SSL handshake
are as follows:

1. The SSL or TLS client sends a “client hello” message that lists
cryptographic information such as the SSL or TLS version and, in the
client's order of preference, the CipherSuites supported by the client. The
message also contains a random byte string that is used in subsequent
computations. The protocol allows for the “client hello” to include the data
compression methods supported by the client.
16

2. The SSL or TLS server responds with a “server hello” message that
contains the CipherSuite chosen by the server from the list provided by the
client, the session ID, and another random byte string. The server also sends
its digital certificate. If the server requires a digital certificate for client
authentication, the server sends a “client certificate request” that includes a
list of the types of certificates supported and the Distinguished Names of
acceptable Certification Authorities (CAs).

3. The SSL or TLS client verifies the server's digital certificate. For more
information, see How SSL and TLS provide identification, authentication,
confidentiality, and integrity.

4. The SSL or TLS client sends the random byte string that enables both the
client and the server to compute the secret key to be used for encrypting
subsequent message data. The random byte string itself is encrypted with
the server's public key.

5. If the SSL or TLS server sent a “client certificate request”, the client sends
a random byte string encrypted with the client's private key, together with
the client's digital certificate, or a “no digital certificate alert”. This alert is
only a warning, but with some implementations the handshake fails if client
authentication is mandatory.

6. The SSL or TLS server verifies the client's certificate. For more
information, see How SSL and TLS provide identification, authentication,
confidentiality, and integrity.

7. The SSL or TLS client sends the server a “finished” message, which is
encrypted with the secret key, indicating that the client part of the
handshake is complete.
17

8. The SSL or TLS server sends the client a “finished” message, which is
encrypted with the secret key, indicating that the server part of the
handshake is complete.

9. For the duration of the SSL or TLS session, the server and client can now
exchange messages that are symmetrically encrypted with the shared secret
key.

SCREENSHOT DIAGRAM:

Home Page-
18

The homepage for any browser is the page that displays first when the user opens the browser.

We developed our Home page using python Libraries using Python code it contains the search engine and
other equipments .

The homepage for any browser is the page that displays first when the user opens the browser. The ACS
directory page, which links to many NMU services, can be found at http://www.acs.nmu.edu/home. This
article explains how to set the homepage to this page in Chrome, Explorer, Safari, and Firefox.

File:-
19

It contains the file there are several options inside there to go there we need to follow the following

Screen shots.

Now we will describe the all the working functions of the file menu.

1) New Tab
20

2)Open file

3)Save file
21

4)About

5)Search option in browser


22

The basics of how Search works

Google is a fully-automated search engine that uses software known as web crawlers that explore the web on
a regular basis to find sites to add to our index. In fact, the vast majority of sites listed in our results aren't
manually submitted for inclusion, but are found and added automatically when our web crawlers crawl the
web.

Google Search works in essentially three stages:

Crawling: Google searches the web with automated programs called crawlers, looking for pages that are
new or updated. Google stores those page addresses (or page URLs) in a big list to look at later. We find
pages by many different methods, but the main method is following links from pages that we already know
about.

Indexing: Google visits the pages that it has learned about by crawling, and tries to analyze what each page
is about. Google analyzes the content, images, and video files in the page, trying to understand what the page
is about. This information is stored in the Google index, a huge database that is stored on many computers.
23

Serving search results: When a user searches on Google, Google tries to determine the highest quality
results. The "best" results have many factors, including things such as the user's location, language, device
(desktop or phone), and previous queries. For example, searching for "bicycle repair shops" would show
different answers to a user in Paris than it would to a user in Hong Kong. Google doesn't accept payment to
rank pages higher, and ranking is done algorithmically.
24

6) Navigation keys

Basic Browser Tools

Arrow Buttons: These two arrows navigate the browser back (the left arrow) to a previously viewed
webpage or forward (the right arrow) to more currently viewed webpages. ...

Refresh Button: This button reloads a webpage. ...

New Tab Button. ...

Resizing and Closing Buttons. ...

Menu Button.

The navigation buttons are used to return the user one step backward in the experience. A typical case is to
have a “Back” button in the top left hand of the navigation bar. As the user travels deeper and deeper into the
pages the “Back” button should always return the user to the previous page.

7) WORKING:-

A browser is a software application used to locate, retrieve and display content on the World Wide Web,
including Web pages, images, video and other files. As a client/server model, the browser is the client run on
a computer that contacts the Web server and requests information. The Web server sends the information
back to the Web browser which displays the results on the computer or other Internet-enabled device that
supports a browser.

Today’s browsers are fully-functional software suites that can interpret and display HTML Web pages,
applications, JavaScript, AJAX and other content hosted on Web servers. Many browsers offer plug-ins
which extend the capabilities of the software so it can display multimedia information (including sound and
25

video), or the browser can be used to perform tasks such as videoconferencing, to design web pages or add
antiphishing filters and other security features to the browser.

A browser is a group of structured codes which together performs a series of tasks to display a web page on
the screen. According to the tasks they perform, these codes are made as different components.

High-level architecture of browser

The below image shows the main components of a web browser:

Main components of the browser

1. The User Interface: The user interface is the space where User interacts with the browser. It includes the
address bar, back and next buttons, home button, refresh and stop, bookmark option, etc. Every other part,
except the window where requested web page is displayed, comes under it.

2. The Browser Engine: The browser engine works as a bridge between the User interface and the rendering
engine. According to the inputs from various user interfaces, it queries and manipulates the rendering
engine.

3. The Rendering Engine: The rendering engine, as the name suggests is responsible for rendering the
requested web page on the browser screen. The rendering engine interprets the HTML, XML documents and
images that are formatted using CSS and generates the layout that is displayed in the User

Interface. However, using plugins or extensions, it can display other types data also. Different browsers user
different rendering engines:

* Internet Explorer: Trident

* Firefox & other Mozilla browsers: Gecko

* Chrome & Opera 15+: Blink

* Chrome (iPhone) & Safari: Webkit

4. Networking: Component of the browser which retrieves the URLs using the common internet protocols of
HTTP or FTP.

The networking component handles all aspects of Internet communication and security. The network
component may implement a cache of retrieved documents in order to reduce network traffic.
26

5. JavaScript Interpreter: It is the component of the browser which interprets and executes the javascript
code embedded in a website. The interpreted results are sent to the rendering engine for display. If the script
is external then first the resource is fetched from the network. Parser keeps on hold until the script is
executed.

6. UI Backend: UI backend is used for drawing basic widgets like combo boxes and windows. This backend
exposes a generic interface that is not platform specific.

It underneath uses operating system user interface methods.

7. Data Persistence/Storage: This is a persistence layer. Browsers support storage mechanisms such as

localStorage, IndexedDB, WebSQL and FileSystem.

It is a small database created on the local drive of the computer where the browser is installed. It manages
user data such as cache, cookies, bookmarks.

8.ADVANTAGES

• The fastest load time for websites

• Uses the latest World Wide Web Standards for displaying websites

• Supports newer technology and newer web coding standards

• Incorporates archiving/bookmarking of website URLs

• Easy integrates with Gmail and other Google products

• Can easily incorporate extentions

• Best developer tools for troubleshooting broken website


27

CODING:-

from PyQt5.QtCore import *

from PyQt5.QtWidgets import *

from PyQt5.QtGui import *

from PyQt5.QtWebEngineWidgets import *

from PyQt5.QtPrintSupport import *

import os

import sys

class AboutDialog(QDialog):

def __init__(self, *args, **kwargs):

super(AboutDialog, self).__init__(*args, **kwargs)

QBtn = QDialogButtonBox.Ok # No cancel

self.buttonBox = QDialogButtonBox(QBtn)

self.buttonBox.accepted.connect(self.accept)

self.buttonBox.rejected.connect(self.reject)

layout = QVBoxLayout()

title = QLabel("Web Browser")


28

font = title.font()

font.setPointSize(20)

title.setFont(font)

layout.addWidget(title)

logo = QLabel()

logo.setPixmap(QPixmap(os.path.join('images', 'ma-icon-128.png')))

layout.addWidget(logo)

layout.addWidget(QLabel("Version 3.0"))

layout.addWidget(QLabel("Copyright@dk "))

for i in range(0, layout.count()):

layout.itemAt(i).setAlignment(Qt.AlignHCenter)

layout.addWidget(self.buttonBox)

self.setLayout(layout)

class MainWindow(QMainWindow):

def __init__(self, *args, **kwargs):

super(MainWindow, self).__init__(*args, **kwargs)


29

self.tabs = QTabWidget()

self.tabs.setDocumentMode(True)

self.tabs.tabBarDoubleClicked.connect(self.tab_open_doubleclick)

self.tabs.currentChanged.connect(self.current_tab_changed)

self.tabs.setTabsClosable(True)

self.tabs.tabCloseRequested.connect(self.close_current_tab)

self.setCentralWidget(self.tabs)

self.status = QStatusBar()

self.setStatusBar(self.status)

navtb = QToolBar("Navigation")

navtb.setIconSize(QSize(16, 16))

self.addToolBar(navtb)

back_btn = QAction(QIcon(os.path.join('images', 'arrow-180.png')), "Back", self)

back_btn.setStatusTip("Back to previous page")

back_btn.triggered.connect(lambda: self.tabs.currentWidget().back())

navtb.addAction(back_btn)

next_btn = QAction(QIcon(os.path.join('images', 'arrow-000.png')), "Forward", self)

next_btn.setStatusTip("Forward to next page")


30

next_btn.triggered.connect(lambda: self.tabs.currentWidget().forward())

navtb.addAction(next_btn)

reload_btn = QAction(QIcon(os.path.join('images', 'arrow-circle-315.png')), "Reload", self)

reload_btn.setStatusTip("Reload page")

reload_btn.triggered.connect(lambda: self.tabs.currentWidget().reload())

navtb.addAction(reload_btn)

home_btn = QAction(QIcon(os.path.join('images', 'home.png')), "Home", self)

home_btn.setStatusTip("Go home")

home_btn.triggered.connect(self.navigate_home)

navtb.addAction(home_btn)

navtb.addSeparator()

self.httpsicon = QLabel() # Yes, really!

self.httpsicon.setPixmap(QPixmap(os.path.join('images', 'lock-nossl.png')))

navtb.addWidget(self.httpsicon)

self.urlbar = QLineEdit()

self.urlbar.returnPressed.connect(self.navigate_to_url)

navtb.addWidget(self.urlbar)

stop_btn = QAction(QIcon(os.path.join('images', 'cross-circle.png')), "Stop", self)


31

stop_btn.setStatusTip("Stop loading current page")

stop_btn.triggered.connect(lambda: self.tabs.currentWidget().stop())

navtb.addAction(stop_btn)

# Uncomment to disable native menubar on Mac

# self.menuBar().setNativeMenuBar(False)

file_menu = self.menuBar().addMenu("&File")

new_tab_action = QAction(QIcon(os.path.join('images', 'ui-tab--plus.png')), "New Tab", self)

new_tab_action.setStatusTip("Open a new tab")

new_tab_action.triggered.connect(lambda: self.add_new_tab()) #//..........................................

file_menu.addAction(new_tab_action)

open_file_action = QAction(QIcon(os.path.join('images', 'disk--arrow.png')), "Open file...", self)

open_file_action.setStatusTip("Open from file")

open_file_action.triggered.connect(self.open_file)

file_menu.addAction(open_file_action)

save_file_action = QAction(QIcon(os.path.join('images', 'disk--pencil.png')), "Save Page As...", self)

save_file_action.setStatusTip("Save current page to file")

save_file_action.triggered.connect(self.save_file)

file_menu.addAction(save_file_action)
32

print_action = QAction(QIcon(os.path.join('images', 'printer.png')), "Print...", self)

print_action.setStatusTip("Print current page")

print_action.triggered.connect(self.print_page)

file_menu.addAction(print_action)

help_menu = self.menuBar().addMenu("&Help")

about_action = QAction(QIcon(os.path.join('images', 'question.png')), "About Web Browser", self)

about_action.setStatusTip("Find out more about Web Browser") # Hungry!

about_action.triggered.connect(self.about)

help_menu.addAction(about_action)

navigate_mozarella_action = QAction(QIcon(os.path.join('images', 'lifebuoy.png')),

"Web Browser Homepage", self)

navigate_mozarella_action.setStatusTip("Go to Web Browser Homepage")

navigate_mozarella_action.triggered.connect(self.navigate_mozarella)

help_menu.addAction(navigate_mozarella_action)

self.add_new_tab(QUrl('https://Google.com'), 'Homepage')

self.show()

self.setWindowTitle("Web Browser")

self.setWindowIcon(QIcon(os.path.join('images', 'ma-icon-64.png')))
33

def add_new_tab(self, qurl=None, label="New Tab"):

if qurl is None:

qurl = QUrl('https://google.com')

browser = QWebEngineView()

browser.setUrl(qurl)

i = self.tabs.addTab(browser, label)

self.tabs.setCurrentIndex(i)

# More difficult! We only want to update the url when it's from the

# correct tab

browser.urlChanged.connect(lambda qurl, browser=browser:

self.update_urlbar(qurl, browser))

browser.loadFinished.connect(lambda _, i=i, browser=browser:

self.tabs.setTabText(i, browser.page().title()))

def tab_open_doubleclick(self, i):

if i == -1: # No tab under the click

self.add_new_tab()
34

def current_tab_changed(self, i):

qurl = self.tabs.currentWidget().url()

self.update_urlbar(qurl, self.tabs.currentWidget())

self.update_title(self.tabs.currentWidget())

def close_current_tab(self, i):

if self.tabs.count() < 2:

return

self.tabs.removeTab(i)

def update_title(self, browser):

if browser != self.tabs.currentWidget():

# If this signal is not from the current tab, ignore

return

title = self.tabs.currentWidget().page().title()

self.setWindowTitle("%s - Web Browser" % title)

def navigate_mozarella(self):

self.tabs.currentWidget().setUrl(QUrl("https://Google.com"))

def about(self):

dlg = AboutDialog()
35

dlg.exec_()

def open_file(self):

filename, _ = QFileDialog.getOpenFileName(self, "Open file", "",

"Hypertext Markup Language (*.htm *.html);;"

"All files (*.*)")

if filename:

with open(filename, 'r') as f:

html = f.read()

self.tabs.currentWidget().setHtml(html)

self.urlbar.setText(filename)

def save_file(self):

filename, _ = QFileDialog.getSaveFileName(self, "Save Page As", "",

"Hypertext Markup Language (*.htm *html);;"

"All files (*.*)")

if filename:

html = self.tabs.currentWidget().page().toHtml()

with open(filename, 'w') as f:

f.write(html.encode('utf8'))
36

def print_page(self):

dlg = QPrintPreviewDialog()

dlg.paintRequested.connect(self.browser.print_)

dlg.exec_()

def navigate_home(self):

self.tabs.currentWidget().setUrl(QUrl("https://Google.com"))

def navigate_to_url(self): # Does not receive the Url

q = QUrl(self.urlbar.text())

if q.scheme() == "":

q.setScheme("http")

self.tabs.currentWidget().setUrl(q)

def update_urlbar(self, q, browser=None):

if browser != self.tabs.currentWidget():

# If this signal is not from the current tab, ignore

return

if q.scheme() == 'https':

# Secure padlock icon

self.httpsicon.setPixmap(QPixmap(os.path.join('images', 'lock-ssl.png')))
37

else:

# Insecure padlock icon

self.httpsicon.setPixmap(QPixmap(os.path.join('images', 'lock-nossl.png')))

self.urlbar.setText(q.toString())

self.urlbar.setCursorPosition(0)

app = QApplication(sys.argv)

app.setApplicationName("Web Browser")

app.setOrganizationName("Dinesh")

app.setOrganizationDomain("Google.com")

window = MainWindow()

app.exec_()
38

Testing:-

We are finding some error because we are not install pyqrt5 library then we can got our output correct.
39

Now we run the codes on python idle


40

Conclusion & Limitations:-

• It is used to open the web pages on the computer screen

. • Web browser is a technology platform for the compilation, interpretation and passage of
data tools on the Web.

• Firefox, Internet Explorer, Google Chrome, Opera, and Safari are the examples of web
browsers.

• A web browser picks up the appropriate content from a browser and afterwards presents the
corresponding page on the browser of the client.

• The Web server transmits the data to the Browser that shows an information on the device
or any other appenabled device enabling a website.

Reference:-

-Git Hub

-Google

-To install PyQt5 please visit [PyPI](https://pypi.org/)

-Youtube- https://youtu.be/pwJC0teC-Ok

You might also like