Simple answer - Security. Salesforce wants to keep tight control over what is customizable and what is not. Consider an example of a Visual force page running within your standard page-layout. If it runs in the same domain, the scripts in the VF page will be able to access the scripts on the standard page-layout and will be able to manipulate it.
As a matter of fact there used to be a side-bar hack where users could run scripts from side-bar and manipulate standard pages, which has since been disabled by ensuring all scripts and vf pages run in a different domain. Was this an interview question you had to face? :P
Simple answer - Security. Salesforce wants to keep tight control over what is customizable and what is not. Consider an example of a Visual force page running within your standard page-layout. If it runs in the same domain, the scripts in the VF page will be able to access the scripts on the standard page-layout and will be able to manipulate it.
As a matter of fact there used to be a side-bar hack where users could run scripts from side-bar and manipulate standard pages, which has since been disabled by ensuring all scripts and vf pages run in a different domain. Was this an interview question you had to face? :P
I wish they had maintained the consistency and served the lightning components/LWC from the same domain as vf page. because you cannot use vf inside lightning components with click-jack enabled.
As a matter of fact there used to be a side-bar hack where users could run scripts from side-bar and manipulate standard pages, which has since been disabled by ensuring all scripts and vf pages run in a different domain. Was this an interview question you had to face? :P
All Answers
As a matter of fact there used to be a side-bar hack where users could run scripts from side-bar and manipulate standard pages, which has since been disabled by ensuring all scripts and vf pages run in a different domain. Was this an interview question you had to face? :P
because you cannot use vf inside lightning components with click-jack enabled.