I have a problem with mvc4 application.
I have created a masterpage with "bundleconfig" for css and js file.
so far so good ... everything works, such as "localhost1234:/Admin/Index" I see everything correctly.
The problem is when I go to the page "localhost1234:/Admin/Edit/2" (2 is user id por update) here does not find references in the file main.js
The file main.js is this:
`
head.js("../assets/js/skin-select/jquery.cookie.js");
head.js("../assets/js/skin-select/skin-select.js");
head.js("../assets/js/clock/date.js");
`
In the error console of the browser says that not found the reference:
404 Not Found - localhost:1234/Admin/assets/js/jquery.cookie.js"
jquery.cookie.js
404 Not Found - localhost:1234/Admin/assets/js/bootstrap.js"
Why he put the name of the view (Admin) front the path in the main.js file ???
Can you help me?
Use Url.Content helper to generate the right path from the relative path like this:
head.js('#Url.Content("~/assets/js/skin-select/jquery.cookie.js")');
Currently it is trying to find in the Admin folder assets--> js-->jquery.cookie.js.
After using Url.Content() it will first get the RootDirectory and the address will be like : http://localhost/assests/js/skin-select/jquery.cookie.js
Related
I've got the following structure:
pages/blog/[...slug].jsx
pages/blog/Create.jsx
The main problem is, I've got no idea how to make the "create" file unavailable for a browser navigation.
I need to open this "Create" page (Component) in my slug file. I know, I can create another directory and add files like that over there, but I don't find a such type of approach convenient.
Can I do something like this in the nextjs context?
Make a seperate folder other than pages ,like example components folder
-pages
->blog
->[slug].jsx
-components
->Create.jsx
Now u can import Create.jsx in your [slug].jsx file.
I am trying to run Jquery without internet connection, and I have problem with the path to it. My project is in ASP.NET core.
When I entered code like this:<script src="jquery-3.4.1.js"></script>
and I got this error in my browser console :
GET https://localhost:44374/myProject/jquery-3.4.1.js net::ERR_ABORTED 404
I inserted Jquery file right into my root directory and to several others, but that did not work.
So how do I prevent c# from thinking that jquery-3.4.1.js is an action inside my controller ? (I do not want to use absolute path)
Pass root directory './' and certify that file has the same name.
<script src="./jquery-3.4.1.js"></script>
In my assets/www/index.html, I am trying to open html in the
/data/data/files/xyz/index.html with this javascript command:
window.location.href = cordova.file.dataDirectory + "xyz/index.html";
In the ../xyz/index.html it also included the cordova.js which exists on the same xyz directory:
<script type="text/javascript" src="cordova.js"></script>
The index.html can be loaded, but in the catlog show error like below
W/CordovaWebViewImpl﹕ Blocked (possibly sub-frame) navigation to
non-allowed URL: gap://ready
is there something wrong with my method? Is it wrong to use window.location.href to open another cordova application in the data folder ?
EDIT : I already found the root cause, that is my cordova.js in the /data/data/files/xyz/cordova.js is having different version with the one in asset folder. after i copied the same cordova js version, it can be loaded without error warning. Thanks.
You don't need to use "cordova.file.datadirectory". That's only if you use the file plugin for accessing data files, such as saving high-scores in a game or level data. You do not use the plugin for loading/unloading pages into the current webview.
You would want all of your HTML files to be in the same folder branch as your "index.html". Assume a directory structure like this:
/ index.html <!---- this is your current index.html
/ page2.html
/ js / index.js
/ xyz /index.html
All you would have to do is window.location='xyz/index.html'. However, I strongly encourage you to not replace entire pages if you're developing for iOS. It's almost a guarenteed way to get your app rejected. Try loading your pages in via AJAX using a framework like "Framework7".
NOTE: You can only view files within the webview, that are in the same folder or are children of, as your initial index.html.
EDIT: You want to load another Cordova webview application. I'd suggest still making it a child of the initial "index.html" folder. However, you might be able to write a plugin or customize the platform itself to access the other files. However, that's out of the scope of this question!
I have the following solution structure.
cabinet (folder)
cabinet.aspx
images (folder)
script (folder)
folder1
menu.js
userControl (folder)
menu.ascx
default.aspx
Inside of userControl I have menu.ascx (UserControl).
Inside of menu.ascx I am referencing several .js files. For example:
<script src="./script/folder1/menu.js"></script>
When I view the default.aspx that calls menu.ascx it works fine.
However, when I'm in the cabinet folder looking at cabinet.aspx (cabinet\cabinet.aspx) that also calls menu.ascx
<%# Register Src="../userControl/menu.ascx" TagName="menu" TagPrefix="uc2" %>
The menu code is in the source but the menu.js file is a 404
http://localhost/cabinet/script/menu-files/menu.js
It looks like it needs to go directory further out. I would of expected it to go to:
http://localhost/script/menu/menu.js
What do I need to do to accomplish this?
One of two approaches:
Anchor the script reference to the site root with an absolute reference via "/script/folder1/menu.js" (note how it starts with a forward slash). For example, <script src="/script/folder1/menu.js"></script>. This says to look at the root of the site and carry on from there.
Have the script tag runat="server" and root it to the application root via "~/script/folder1/menu.js" (note the "~/" start). For example <script runat="server" src="~/script/folder1/menu.js"></script>. This determines the site root server-side and generates the correct path accordingly.
In all cases except for when your development environment doesn't allow it (I'm showing my age there going back to WinXP for development) or you are configuring an app that will live in a virtual application sub-directory in your site, go with the first option.
I figured out that the issue was the Visual Studio Web Instance that was being fired off and the fact that there were headers that needed to be set on IIS to allow the code to work.
So essentially I installed IIS 7.5 and created a site and now I just attach to the process to do my debugging for this.
Once I got IIS setup correctly the paths that were in code worked.
In my ASP.Net project, I have implemented URL Routing. So even if my page is in the root directory, I am accessing it using URL routing as given below:
My actual Page is projectpage.aspx, which is in the root directory. I have registered its route as project/{projectname}/{cityname}/{projectid}.
There is another javascript which is included in this page. In this javascript, there is a code to access images in "resources" folder which is done by simply resources/{imagename}, but when I do View Source of the page, the path is shown like project/{projectname}/{cityname}/{projectid}/resources/{imagename}. But the "resources" folder is also in the root folder.
I also tried using "~/" before resources folder, but same thing happens.
Please let me know in case anyone has a solution to this problem.
Thanks & Regards,
Munjal
it think you should try /resources/{imagename}