My mac is completely blocked because of a pop up that doesn't let me open any app or safari's page. What do i have to do?!?!

I was on the internet playing a game them suddenly a pop up page came on and i pressed the "x" at the top to exit (like i always do) than the page askes me "are you sure you want to leave this page?" The text after this is so long that i can't say "leave this page" i tried to open other apps or pages but it tells me that i have to leave this page. I have no idea what to do. I can't even turn off the computer because it tells me that before i have to leave the safari... Please help!!!
Advertisement
Reply

There are several ways to recover.
1. Some of those scam pages can be dismissed very easily. Press the key combination command-W to close the tab or window. A huge box will pop up. Press the return key and both the box and the page will close. If that doesn't happen, continue.
2. Press and hold command-W. You may hear repeating alert sounds. While holding the keys, click the OK button in the popup. A different popup may appear, which you can cancel out of as usual.
3. From the Safari menu bar, select
          Safari ▹ Preferences... ▹ Security
and uncheck the box marked Enable JavaScript. Leave the preferences dialog open.
Close the malicious window or tab.
Re-enable JavaScript and close the preferences dialog.
4. If the Preferences menu item is grayed out, quit Safari. Force quit if necessary. Relaunch it by holding down the shift key and clicking its icon in the Dock. None of the windows and tabs will reopen.
After closing the malicious page, from the menu bar, select
          Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
to get rid of any cookies or other data left by the server. Open your Downloads folder and delete anything you don't recognize.