Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading another page from within the loaded page executes twice #1994

Open
SynSou opened this issue Apr 7, 2021 · 6 comments
Open

Loading another page from within the loaded page executes twice #1994

SynSou opened this issue Apr 7, 2021 · 6 comments

Comments

@SynSou
Copy link

SynSou commented Apr 7, 2021

Short description
I have an index.html with top left main panels.
The content is loaded in the following way

        w2ui['layout'].load('top', 'data/top.html')
        w2ui['layout'].load('left', 'data/left.html')
        w2ui['layout'].load('main', 'data/main.html')

then in the left panel, Click on element a will load another page ( w2ui['layout'].load('main', 'data/another.html'))
but another.html is executed twice

What is current behavior
another.html is executed twice

What is desired behavior
another.html is executed once

Link to jsfidle/codepan with sample code
...

Steps to reproduce or sample
...

Thank you and I look forward to your comments

@SynSou
Copy link
Author

SynSou commented Apr 7, 2021

test code testcode.zip

@mpf82
Copy link
Collaborator

mpf82 commented Apr 7, 2021

Can you please create a fiddle/pen/bin instead of posting your code as a zip file?

@SynSou
Copy link
Author

SynSou commented Apr 7, 2021

i try to create it, but it not work when click on element a

index.html https://jsfiddle.net/wangxianshou/z95c2f7L/24/
leftmenu.html https://jsfiddle.net/wangxianshou/wc7rt9oh/16/
another.html https://jsfiddle.net/wangxianshou/g8k46y1e/4/

@SynSou
Copy link
Author

SynSou commented Apr 7, 2021

test code testcode.zip

code works on the http server https://www.lighttpd.net/

if win10 os ,then http://lighttpd.dtech.hu/

@mpf82
Copy link
Collaborator

mpf82 commented Apr 7, 2021

Seems you're using w2ui 1.4.3 - which was released in 2015.

At least that's what you've linked in the fiddle.

Can't you upgrade to the latest version?

The distribution with the most recent fixes can be downloaded here: https://github.com/vitmalina/w2ui/tree/master/dist (w2ui.js + w2ui.css - not the files with 1.5 in the name)

@SynSou
Copy link
Author

SynSou commented Apr 7, 2021

Thanks for your comments

I tried the steps below

case1

  1. Replace with new version for w2ui
  2. result : The problem is still

case2

  1. Replace with new version for w2ui
  2. import leftmenu.js in index.html instead of leftmenu.html
  3. result : The problem is still

case3

  1. Replace with new version for w2ui
  2. import leftmenu.js when leftmenu.html load success
    w2ui['layout'].load('left','leftmenu.html','slide-left',function(){
        $.getScript('leftmenu.js',function(){console.log('layout.left load after load leftmenu.js')})
        console.log('load leftmenu.html');
    });
  1. result : The problem is still

testcode_withjsnewversion
testcode_withjsnewversion.zip

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants