简体   繁体   中英

Using JavaScript to open a window to an HTML file in MVC 4

I'd like to do the following in MVC 4 through a javascript call:

window.open('MyView/SomePage.html',..);

When I do that now, I get a 404. What are my options?

If the page you are trying to show in window.open is the result of a controller action (a view) try doing:

window.open('@Url.Action("ActionName", "ControllerName")', ...)

This only works if you are using razor...

The error you are having suggests the view/page you are tring to show in a pop up does not exist. The path must be incorrect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM