Recently we have uploaded an aspx page inside the site assets document library in SharePoint Online site. When we click on the aspx page, instead of opening in the browser it asks for saving the document.
Our requirement is the file should be open in the browser, it should not ask to save the file.
We have also checked “Opening Documents in the Browser” settings in the library settings which was already set as “Use the server default (Open in the browser)”. That we can check in library settings -> Advanced settings and in the advanced settings page you can see “Opening Documents in the Browser”.
You can see the fig below:

But still the aspx page was asking to save instead of opening in the browser.
When we upload the aspx page, we use the drag and drop feature of SharePoint to upload the aspx page. Then to resolve the issue, we click on the Upload button and then browse the file and then we upload the document.
Check out the below pic how we upload the document instead of drag and drop and it worked well.

You may like following SharePoint tutorial:
- Page viewer web part in SharePoint Online/2016/2013
- How to add Link to a Document library in SharePoint Online/2013/2016
- Add multiple Office templates as content type to a document library in SharePoint Online/2013/2016
- SharePoint Unique Permissions to List & Document Library in SharePoint Online Step by Step Tutorial
- Add a content type to list or document library in SharePoint Online
- Get SharePoint document library size using PowerShell
- Disable document edit properties based on user permission in SharePoint document library
- Create Folder and Subfolder in SharePoint Document Library using PnP Core CSOM Library
- Microsoft Flow Example: Copy new files from your PC to SharePoint Online Document Library
Hope this will be helpful.
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
For me I tried this on the sharepoint online, and did the upload option for the non-working site. Still it does not work, always downloads the aspx file.