Hi! If you have problems opening webpages, take a look at these troubleshooting techniques suggested by Apple.
https://support.apple.com/en-us/HT204098
Go to Safari menu (At the very top right side of your screen next to Apple icon), choose "Quit Safari"
press "Shift" button and while holding this button on your keyboard single click on the Safari icon on your Dock.
Open Safari - Preferences - Privacy - Remove All Website Data.
Open the Go menu with Option (Alt) key pressed - Library - locate Safari folder and move it to your desktop. Restart your Mac, open Safari and delete the folder from your desktop.
Also, you may try these steps:
Restart your Mac.
Try Safe Boot:
- Shut down your Mac
- Wait until your computer turns off and after that press the Power button
- Right after you hear the startup tone, press and hold the Shift key
- Release the Shift key when you see a grey Apple sign and the progress bar below this sign
- After your Mac boots up, restart it as you usually do.
If this doesn't help, follow the instructions below:
- Shut down your Mac
- Wait until your computer turns off and after that press the Power button
- Right after you hear the startup tone, press and hold the Shift key
- Release the Shift key when you see a grey Apple sign and the progress bar below this sign
- Once you see Desktop, start a Disk Utility scan to detect and repair file system errors (don't forget to choose your main hard drive)
- Click on Verify Disk and then, if asked to fix problems, on Repair Disk
- After this, click on Verify Disk Permissions and then on Repair Disk Permissions
- After the process is finished, shut down your Mac and turn it back on after about 30 seconds
BTW, if you see pop-ups in the browser, you can try using Malwarebytes Anti-Malware: http://www.adwaremedic.com/index.php
You can also remove the adware manually using the steps provided by Apple: https://support.apple.com/en-us/HT203987
After you follow these steps, make sure your default search engine is set to the one you always use. To do so, Open Safari - Preferences - Search.
Hope this helps!