Solution 1 :

You can set the values manually via the command line. First you can query the current values of the three non-iDevice presets with the following command:

defaults read ~/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist ResponsiveDesignCustomPresetConfigurations

which in my case returned the following:

(
        {
        rotated = 0;
        screenHeight = 1200;
        screenWidth = 1600;
    },
        {
        rotated = 0;
        screenHeight = 1536;
        screenWidth = 2732;
    },
        {
        rotated = 0;
        screenHeight = 2160;
        screenWidth = 3840;
        userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15";
    }
)

To change the values, you need to overwrite them. To do so, copy the result of the previous query, adjust it to your liking and write the values back to the plist by using the following command:

defaults write ~/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist ResponsiveDesignCustomPresetConfigurations '<paste your modified settings here>'

e.g.

defaults write ~/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist ResponsiveDesignCustomPresetConfigurations '(
        {
        rotated = 0;
        screenHeight = 1180;
        screenWidth = 1532;
    },
        {
        rotated = 0;
        screenHeight = 1536;
        screenWidth = 2732;
    },
        {
        rotated = 0;
        screenHeight = 2160;
        screenWidth = 3840;
        userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15";
    }
)'

Note:

  • Values for screenHeight and screenWidth must be twice as high as your required dimensions, i.e. 1180 x 1532 if you want to have 590 x 766.
  • Safari should be closed before setting the values.
  • Tested on a MacBook running Mojave and Safari 14.0.1: creating a backup before doing this won’t hurt!

Problem :

By clicking & dragging the sidebar I can resize viewport width. However, through clicking & dragging the side-bar it’s too difficult/impossible to get a particular px-size I want. What can I do?

enter image description here

Comments

Comment posted by stackoverflow.com/questions/38220485/…

You can follow this link it can do your job.:

Comment posted by tacoshy

the viewport size is the size of the browser in pixel and as such controlled by the user. The user decides if he wants to makes his browser smaller and you cant take control of that. Thats why you have the large concept of responsive web design in the first place. However you can predefine how large wide and high the website should be and cause an overflwo with scroll bars by using

Comment posted by tonitone120

@SajjadHosen This doesn’t answer my question. Forget coding. I am in Safari’s Responsive Design Mode. How do I alter it to a particular viewport width px size.

By